Changes for page Maven Kicking the tyres without changing your project structure
Last modified by Henrique Prange on 2015/09/11 17:57
From version 27.1
edited by pierce
on 2008/07/03 14:25
on 2008/07/03 14:25
Change comment:
There is no comment for this version
Summary
-
Page properties (4 modified, 0 added, 0 removed)
-
Attachments (0 modified, 1 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,0 +1,1 @@ 1 +WOLips Tutorials - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.p ierce1 +XWiki.hprange - Tags
-
... ... @@ -1,0 +1,1 @@ 1 +wikireview - Content
-
... ... @@ -31,7 +31,6 @@ 31 31 The layout of the frameworks and applications might look like this: 32 32 33 33 {{noformat}} 34 - 35 35 /trunk/ 36 36 /trunk/apps/ 37 37 /trunk/apps/ApplicationA/ ... ... @@ -52,30 +52,52 @@ 52 52 53 53 Typical things that make up a pom are as follows. (Note: only pom identification is mandatory. All the others have defaults.) 54 54 55 -1. pom identification (who am I?) 56 - The base triplet used to identify an artifact (i.e., something you need to build/package/install) 57 -1. {{noformat}} 54 +1. ((( 55 +pom identification (who am I?) 56 + The base triplet used to identify an artifact (i.e., something you need to build/package/install) 57 + 58 +{{noformat}} 58 58 <artifactId>CustomExtensions</artifactId> 59 59 <groupId>com.mywostuff.frameworks</groupId> 60 60 <version>0.0.1-SNAPSHOT</version> 61 -{{/noformat}}pom packaging (i.e., what are we building?) 62 - The default value for the packaging element is JAR if not specified. For the purposes of this exercise, we'll use JAR for the frameworks and woapplication for the applications, which requires the woproject maven plugin (TODO revisit this scenario with the apple maven plugin) 63 -1. {{noformat}} 64 - <packaging>woapplication</artifactId> 65 -{{/noformat}}pom parent identification (who do I belong to?) 66 -1. {{noformat}} 62 + 63 +{{/noformat}} 64 +))) 65 +1. ((( 66 +pom packaging (i.e., what are we building?) 67 + The default value for the packaging element is JAR if not specified. For the purposes of this exercise, we'll use JAR for the frameworks and woapplication for the applications, which requires the woproject maven plugin (TODO revisit this scenario with the apple maven plugin) 68 + 69 +{{noformat}} 70 + <packaging>woapplication</packaging> 71 + 72 +{{/noformat}} 73 +))) 74 +1. ((( 75 +pom parent identification (who do I belong to?) 76 + 77 +{{noformat}} 67 67 <parent> 68 68 <artifactId>frameworks</artifactId> 69 69 <groupId>com.mywostuff</groupId> 70 70 </parent> 71 -{{/noformat}}modules (a.k.a kids; who belongs to me?) 72 -1. {{noformat}} 82 + 83 +{{/noformat}} 84 +))) 85 +1. ((( 86 +modules (a.k.a kids; who belongs to me?) 87 + 88 +{{noformat}} 73 73 <modules> 74 74 <module>CustomExtensions</module> 75 75 <module>CustomBusinessLogic</module> 76 76 </modules> 77 -{{/noformat}}dependencies (what do I need?) 78 -1. {{noformat}} 93 + 94 +{{/noformat}} 95 +))) 96 +1. ((( 97 +dependencies (what do I need?) 98 + 99 +{{noformat}} 79 79 <dependencies> 80 80 <dependency> 81 81 <groupId>log4j</groupId> ... ... @@ -90,7 +90,10 @@ 90 90 <scope>test</scope> 91 91 </dependency> 92 92 </dependencies> 93 -{{/noformat}}build sources/resources (what do I have?) 114 + 115 +{{/noformat}} 116 +))) 117 +1. build sources/resources (what do I have?) 94 94 1. properties and filtering resources (variable definitions) 95 95 1. dependency/plugin management (shared configuration and versioning) 96 96 1. repositories (where to find dependencies and plugins) ... ... @@ -108,7 +108,6 @@ 108 108 In this case though, we're just trying to "kick the tyres", so we don't want to have to move our files around. The following roughly resembles the current WebObjects WOLips produced project layout (a.k.a Fluffy Bunny layout). 109 109 110 110 {{noformat}} 111 - 112 112 /MyProject 113 113 /MyProject/Components 114 114 /MyProject/Resources ... ... @@ -120,8 +120,7 @@ 120 120 121 121 Assuming your building a framework, for example, the following is an extract from the relevant pom.xml. It specifies where to find your java source files and resources, we can put this in /trunk/pom.xml and then all the child pom.xml files will know we're using Fluffy Bunny Layout. Notice we've also defined the target path for each resource. (See the [[WOL:Maven Model#class_resource>>url:http://maven.apache.org/ref/2.0.9/maven-model/maven.html#class_resource||shape="rect"]] for a definition of targetPath) 122 122 123 -{{code title="pom.xml" 0="xml"}} 124 - 146 +{{code 0="xml" title="pom.xml"}} 125 125 <...> 126 126 <build> 127 127 <sourceDirectory>Sources</sourceDirectory> ... ... @@ -158,7 +158,6 @@ 158 158 The following shows the mixture of third party dependencies and custom framework dependencies. Notice that the scope element determines the life cycle phase each dependency is relevant for. See [[WOL:Maven Model#class_dependency>>url:http://maven.apache.org/ref/2.0.9/maven-model/maven.html#class_dependency||shape="rect"]] for specific definitions. 159 159 160 160 {{noformat}} 161 - 162 162 <dependencies> 163 163 <dependency> 164 164 <artifactId>CustomExtensions</artifactId> ... ... @@ -193,7 +193,6 @@ 193 193 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>>url:http://maven.apache.org/guides/introduction/introduction-to-repositories.html||shape="rect"]]. Repositories are what lets you specify, "my app needs commons-logging-1.1.1" and maven can then pull it into the build as needed. Here we're adding some additional repositories to the defaults. You might want to setup one for your workgroup, and then there are some useful WO-related ones as well. We can include this in the master trunk/pom.xml file, then all the children can use it. 194 194 195 195 {{noformat}} 196 - 197 197 <repositories> 198 198 <repository> 199 199 <id>system-repo</id> ... ... @@ -267,10 +267,11 @@ 267 267 268 268 Here's the definition for /frameworks/pom.xml, definitions here will be shared by all of the individual framework pom.xml files. Note that it depends on the following Info.plist file being located under trunk/frameworks/src/main/resources (maven builds can use files stored in common off of a shared structure): 269 269 270 -{{attachments patterns="Info.plist" upload="false"/}} 271 271 272 -{{code title="/frameworks/pom.xml" 0="xml"}} 273 273 292 +{{attachments upload="false" patterns="Info.plist"/}} 293 + 294 +{{code 0="xml" title="/frameworks/pom.xml"}} 274 274 <?xml version="1.0" encoding="UTF-8"?> 275 275 <project xmlns="http://maven.apache.org/POM/4.0.0" 276 276 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... ... @@ -396,8 +396,7 @@ 396 396 397 397 Since our CustomExtensions has no further dependencies, its pom.xml merely specifies its parent and its identity. 398 398 399 -{{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}} 400 - 420 +{{code 0="xml" title="/frameworks/CustomBusinessLogic/pom.xml"}} 401 401 <?xml version="1.0"?> 402 402 <project> 403 403 <!-- parent artifact --> ... ... @@ -416,8 +416,7 @@ 416 416 417 417 CustomBusinessLogic has a further dependency on CustomExtensions, so it specifies its parent, its identity, and the dependency. 418 418 419 -{{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}} 420 - 439 +{{code 0="xml" title="/frameworks/CustomBusinessLogic/pom.xml"}} 421 421 <?xml version="1.0"?> 422 422 <project> 423 423 <!-- parent artifact --> ... ... @@ -446,8 +446,7 @@ 446 446 447 447 Here's the definition for /apps/pom.xml which is shared by any sub-modules (i.e., ApplicationA and ApplicationB). Both apps need certain WebObjects frameworks, so we specify those only once for both, here in the parent pom. We also specify Fluffy Bunny Layout, and some maven plugins we want to use. Again, this is for both applications. 448 448 449 -{{code title="/apps/pom.xml" 0="xml"}} 450 - 468 +{{code 0="xml" title="/apps/pom.xml"}} 451 451 <?xml version="1.0" encoding="UTF-8"?> 452 452 <project xmlns="http://maven.apache.org/POM/4.0.0" 453 453 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... ... @@ -609,8 +609,7 @@ 609 609 610 610 With most stuff specified in the parent pom, ApplicationA needs only to specify its parent, its idenity, and add a couple of extra specific dependencies to those inherited from its parent. 611 611 612 -{{code title="/apps/ApplicationA/pom.xml" 0="xml"}} 613 - 630 +{{code 0="xml" title="/apps/ApplicationA/pom.xml"}} 614 614 <?xml version="1.0"?> 615 615 <project> 616 616 <modelVersion>4.0.0</modelVersion> ... ... @@ -671,7 +671,7 @@ 671 671 672 672 === Packaging Applications as True WAR === 673 673 674 -You can find steps to package WO Applications as True WAR [[here>>doc:WOL.Packaging WO Applications as true WAR with Maven]]. 691 +You can find steps to package WO Applications as True WAR [[here>>doc:WOL.Home.WOProject-Maven.Packaging WO Applications as true WAR with Maven.WebHome]]. 675 675 676 676 === Eclipse Integration === 677 677
- Info.plist
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.XWikiGuest - Size
-
... ... @@ -1,0 +1,1 @@ 1 +1.6 KB - Content