Changes for page Maven Kicking the tyres without changing your project structure
Last modified by Henrique Prange on 2015/09/11 17:57
To version 22.1
edited by Lachlan Deck
on 2008/06/24 00:39
on 2008/06/24 00:39
Change comment:
Add tip to hang in there with longish guide.
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -201,15 +201,9 @@ 201 201 202 202 {{/noformat}} 203 203 204 -=== Project Inheritance === 205 - 206 -It naturally gets a bit boring having to define the same things over and over again. So, you can utilise a parent pom file specifying its packaging as 'pom'. Dependencies, plugins and executions, resources specifications and so forth can be defined once and shared by any sub-modules. See [[http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance]] and [[Java World's The Maven 2 POM demystified>>http://www.javaworld.com/javaworld/jw-05-2006/jw-0529-maven.html]] for further information and examples. 207 - 208 -For our example we'll have trunk/pom.xml which will define everything common to any and all modules in the hierarchy. Likewise, trunk/frameworks/pom.xml and trunk/apps/pom.xml will define everything common to frameworks and applications respecively. 209 - 210 210 === Repositories === 211 211 212 -So far we have assumed that maven just knows where to find third party libraries. There is the default local repository (e.g., /.m2/repository) and a remote one at ibiblio.org or a mirror of the same. See [[http://maven.apache.org/guides/introduction/introduction-to-repositories.html]]. 206 +So far we have assumed that maven just knows where to find third party libraries. There is the default local repository (e.g., ,,/.m2/repository) and a remote one at ibiblio.org or a mirror of the same. See [[http://maven.apache.org/guides/introduction/introduction-to-repositories.html]].,, 213 213 214 214 {{noformat}} 215 215 ... ... @@ -284,10 +284,8 @@ 284 284 285 285 === Packaging Frameworks as Jars === 286 286 287 -Here's the definition for /frameworks/pom.xml. Note that it depends on the following Info.plist file being located under trunk/frameworks/src/main/resources:281 +Here's the definition for /frameworks/pom.xml. 288 288 289 -{{attachments patterns="Info.plist" upload="false"}}{{/attachments}} 290 - 291 291 {{code title="/frameworks/pom.xml"}} 292 292 293 293 <?xml version="1.0" encoding="UTF-8"?> ... ... @@ -297,7 +297,7 @@ 297 297 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 298 298 299 299 <modelVersion>4.0.0</modelVersion> 300 - 292 + 301 301 <!-- parent artifact --> 302 302 <parent> 303 303 <artifactId>mywostuff</artifactId> ... ... @@ -309,7 +309,7 @@ 309 309 <artifactId>frameworks</artifactId> 310 310 <groupId>com.mywostuff</groupId> 311 311 <packaging>pom</packaging> 312 - 304 + 313 313 <!-- framework relevant properties --> 314 314 <properties> 315 315 <!-- NS related properties fills in Info.plist etc--> ... ... @@ -449,7 +449,7 @@ 449 449 <!-- artifact identity --> 450 450 <artifactId>CustomBusinessLogic</artifactId> 451 451 <groupId>com.mywostuff.frameworks</groupId> 452 - 444 + 453 453 <!-- specific dependencies --> 454 454 <dependencies> 455 455 <dependency> ... ... @@ -463,235 +463,18 @@ 463 463 464 464 === Packaging Applications === 465 465 466 - Here's thedefinition for /apps/pom.xml which is shared by any sub-modules(i.e., ApplicationAand ApplicationB).458 +details to come... 467 467 468 - {{codetitle="/apps/pom.xml"}}460 +=== Packaging Applications as True WAR === 469 469 470 -<?xml version="1.0" encoding="UTF-8"?> 471 -<project xmlns="http://maven.apache.org/POM/4.0.0" 472 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 473 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 474 - http://maven.apache.org/xsd/maven-4.0.0.xsd"> 462 +You can find steps to package WO Applications as True WAR [[here>>Packaging WO Applications as true WAR with Maven]]. 475 475 476 - <modelVersion>4.0.0</modelVersion>464 +more details to come... 477 477 478 - <!-- parent artifact --> 479 - <parent> 480 - <groupId>com</groupId> 481 - <artifactId>mywostuff</artifactId> 482 - <version>1.0-SNAPSHOT</version> 483 - </parent> 466 +=== Project Inheritance === 484 484 485 - <!-- artifact identity --> 486 - <artifactId>apps</artifactId> 487 - <groupId>com.mywostuff</groupId> 488 - <packaging>pom</packaging> 468 +details to come... 489 489 490 - <!-- modules --> 491 - <modules> 492 - <module>ApplicationA</module> 493 - <module>ApplicationB</module> 494 - </modules> 495 - 496 - <!-- specific dependencies (for modules) --> 497 - <dependencies> 498 - <!-- wonder frameworks --> 499 - <dependency> 500 - <artifactId>ERExtensions</artifactId> 501 - <groupId>${wonder.common.groupId}</groupId> 502 - </dependency> 503 - <dependency> 504 - <artifactId>JavaWOExtensions</artifactId> 505 - <groupId>${wonder.common.groupId}</groupId> 506 - </dependency> 507 - 508 - <!-- project libs --> 509 - <dependency> 510 - <artifactId>CustomExtensions</artifactId> 511 - <groupId>${my.frameworks.groupId}</groupId> 512 - </dependency> 513 - <dependency> 514 - <artifactId>CustomBusinessLogic</artifactId> 515 - <groupId>${my.frameworks.groupId}</groupId> 516 - </dependency> 517 - 518 - <!-- webobjects dependencies --> 519 - <dependency> 520 - <artifactId>JavaFoundation</artifactId> 521 - <groupId>${webobjects.groupId}</groupId> 522 - </dependency> 523 - <dependency> 524 - <artifactId>JavaJDBCAdaptor</artifactId> 525 - <groupId>${webobjects.groupId}</groupId> 526 - </dependency> 527 - <dependency> 528 - <artifactId>JavaWebObjects</artifactId> 529 - <groupId>${webobjects.groupId}</groupId> 530 - </dependency> 531 - <dependency> 532 - <artifactId>JavaEOControl</artifactId> 533 - <groupId>${webobjects.groupId}</groupId> 534 - </dependency> 535 - <dependency> 536 - <artifactId>JavaEOAccess</artifactId> 537 - <groupId>${webobjects.groupId}</groupId> 538 - </dependency> 539 - <dependency> 540 - <artifactId>JavaWebObjects</artifactId> 541 - <groupId>${webobjects.groupId}</groupId> 542 - </dependency> 543 - <dependency> 544 - <artifactId>JavaXML</artifactId> 545 - <groupId>${webobjects.groupId}</groupId> 546 - </dependency> 547 - </dependencies> 548 - 549 - <!-- build config (for modules) --> 550 - <build> 551 - <sourceDirectory>src</sourceDirectory> 552 - <testSourceDirectory>tests</testSourceDirectory> 553 - <resources> 554 - <resource> 555 - <targetPath>Resources</targetPath> 556 - <filtering>false</filtering> 557 - <directory>Components</directory> 558 - </resource> 559 - <resource> 560 - <targetPath>Resources</targetPath> 561 - <filtering>false</filtering> 562 - <directory>Resources</directory> 563 - </resource> 564 - <resource> 565 - <targetPath>WebServerResources</targetPath> 566 - <filtering>false</filtering> 567 - <directory>WebServerResources</directory> 568 - </resource> 569 - </resources> 570 - <plugins> 571 - <plugin> 572 - <artifactId>maven-wolifecycle-plugin</artifactId> 573 - <groupId>org.objectstyle.woproject.maven2</groupId> 574 - <version>2.0.15</version> 575 - <extensions>true</extensions> 576 - <configuration> 577 - <source>${java.target}</source> 578 - <target>${java.target}</target> 579 - </configuration> 580 - </plugin> 581 - <plugin> 582 - <groupId>org.apache.maven.plugins</groupId> 583 - <artifactId>maven-javadoc-plugin</artifactId> 584 - <configuration> 585 - <javadocVersion>${java.target}</javadocVersion> 586 - <locale>en-AU</locale> 587 - <minmemory>128m</minmemory> 588 - <maxmemory>512m</maxmemory> 589 - </configuration> 590 - </plugin> 591 - <!-- 592 - TODO build numbering 593 - <plugin> 594 - <groupId>org.codehaus.mojo</groupId> 595 - <artifactId>maven-buildnumber-plugin</artifactId> 596 - <version>0.9.6</version> 597 - <executions> 598 - <execution> 599 - <phase>validate</phase> 600 - <goals> 601 - <goal>create</goal> 602 - </goals> 603 - </execution> 604 - </executions> 605 - <configuration> 606 - <doCheck>true</doCheck> 607 - <doUpdate>true</doUpdate> 608 - </configuration> 609 - </plugin> 610 - --> 611 - </plugins> 612 - <pluginManagement> 613 - <plugins> 614 - <plugin> 615 - <groupId>org.apache.maven.plugins</groupId> 616 - <artifactId>maven-compiler-plugin</artifactId> 617 - <configuration> 618 - <source>${java.target}</source> 619 - <target>${java.target}</target> 620 - </configuration> 621 - </plugin> 622 - </plugins> 623 - </pluginManagement> 624 - </build> 625 -</project> 626 - 627 -{{/code}} 628 - 629 -and ApplicationA - which has a couple of extra specific dependencies to add to those inherited from its parent. 630 - 631 -{{code title="/apps/ApplicationA/pom.xml"}} 632 - 633 -<?xml version="1.0"?> 634 -<project> 635 - <modelVersion>4.0.0</modelVersion> 636 - 637 - <!-- parent artifact --> 638 - <parent> 639 - <artifactId>apps</artifactId> 640 - <groupId>com.mywostuff</groupId> 641 - <version>1.0-SNAPSHOT</version> 642 - <relativePath>../apps</relativePath> <!-- e.g., (optional) if your app is under /trunk --> 643 - </parent> 644 - 645 - <!-- artifact identity --> 646 - <artifactId>ApplicationA</artifactId> 647 - <groupId>com.mywostuff.apps</groupId> 648 - <packaging>woapplication</packaging> <!-- woproject specific packaging --> 649 - 650 - <!-- specific properties --> 651 - <properties> 652 - <!-- general properties --> 653 - <mainclass>your.app.Application</mainclass> 654 - </properties> 655 - 656 - <!-- specific dependencies --> 657 - <dependencies> 658 - <!-- wonder frameworks --> 659 - <dependency> 660 - <artifactId>Ajax</artifactId> 661 - <groupId>${wonder.ajax.groupId}</groupId> 662 - </dependency> 663 - <dependency> 664 - <artifactId>ERCaptcha</artifactId> 665 - <groupId>${wonder.common.groupId}</groupId> 666 - <!-- requires jcaptcha-all below --> 667 - </dependency> 668 - <dependency> 669 - <artifactId>WOOgnl</artifactId> 670 - <groupId>${wonder.common.groupId}</groupId> 671 - </dependency> 672 - 673 - <!-- general libs --> 674 - <dependency> 675 - <artifactId>jcaptcha-all</artifactId> 676 - <groupId>com.octo.captcha</groupId> 677 - </dependency> 678 - <dependency> 679 - <artifactId>commons-collections</artifactId> 680 - <groupId>commons-collections</groupId> 681 - </dependency> 682 - <dependency> 683 - <groupId>ognl</groupId> 684 - <artifactId>ognl</artifactId> 685 - </dependency> 686 - </dependencies> 687 -</project> 688 - 689 -{{/code}} 690 - 691 -=== Packaging Applications as True WAR === 692 - 693 -You can find steps to package WO Applications as True WAR [[here>>Packaging WO Applications as true WAR with Maven]]. 694 - 695 695 === Eclipse Integration === 696 696 697 697 details to come...