Last modified by Henrique Prange on 2015/09/11 17:57

From version 19.1
edited by Henrique Prange
on 2008/06/15 19:35
Change comment: There is no comment for this version
To version 27.1
edited by pierce
on 2008/07/03 14:25
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.hprange
1 +XWiki.pierce
Content
... ... @@ -1,19 +1,33 @@
1 1  So you're interested in //kicking the maven tyres//, so to speak, or just want to see what it's all about. The following provides hints on how to try maven with your current WebObjects projects, if say you're using the standard WOLips ant builds, without having to adopt a different file structure. Whilst this is not the recommended approach for the long term it allows you to try things out side-by-side with your current build system.
2 2  
3 3  {{info title="Recommended Homework (or pre-requisites)"}}
4 +It's //really// worth doing your homework on maven in order to understand it. The place to start is Learning Maven found at [[http:~~/~~/maven.apache.org>>url:http://maven.apache.org||shape="rect"]]. Various guides are also found at [[http:~~/~~/maven.apache.org/guides/>>url:http://maven.apache.org/guides/||shape="rect"]].
4 4  
5 -It's _really_ worth doing your homework on maven in order to understand it. The place to start is Learning Maven found at [http://maven.apache.org]. Various guides are also found at [http://maven.apache.org/guides/].
6 +At the very least you want to have read through, and understood, the [[Getting Started Tutorial>>url:http://maven.apache.org/guides/getting-started/index.html||shape="rect"]].
6 6  
7 -At the very least you want to have read through, and understood, the [Getting Started Tutorial|http://maven.apache.org/guides/getting-started/index.html].
8 +The maven user mailing list is also recommended for getting help. It's quite active and, as you find for the WebObjects mailing lists, is an invaluable resource. See [[Getting Help>>url:http://maven.apache.org/users/getting-help.html||shape="rect"]].
9 +{{/info}}
8 8  
9 -The maven user mailing list is also recommended for getting help. It's quite active and, as you find for the WebObjects mailing lists, is an invaluable resource. See [Getting Help|http://maven.apache.org/users/getting-help.html].
11 +{{tip title="Hang in there"}}
12 +This particular guide might look long but some of the xml is duplicated a few times to show differing examples.
13 +{{/tip}}
10 10  
11 -{{/info}}
15 +=== Why Maven ===
12 12  
13 -=== What's the aim ===
17 +This might be stating the obvious, but an OO developer will, in the course of time (or is //supposed// to anyway), build up various encapsulated, //reusable//, libraries or frameworks that can be tapped into for differing projects. In addition, those frameworks or libraries will themselves often depend on third party frameworks like apache commons, log4j, or WebObjects.
14 14  
15 -This might be stating the obvious, but an OO developer will, in the course of time (or is //supposed// to anyway), build up various encapsulated, //reusable//, libraries or frameworks that can be tapped into for differing projects. So let's assume we have multiple frameworks and applications in our build. Each of these has some common ground, such as their dependencies on certain WebObjects frameworks, or the file layout, and of course they each may have something distinctive about them.
19 +It can be extraordinarily tedious to manage downloading, installing, compiling, and packaging these dependencies. Just finding a particular version of commons-logging-1.1.jar can take 20 minutes. Then everyone in your workgroup has to agree where to put it, and copy it over. If you decide to update to 1.1.1, you have to talk to everyone in your workgroup again, remember to put it into production when you deploy, etc.
16 16  
21 +This is not a new problem in computer science. There are other tools that attempt to solve this problem, maven just takes it beyond just the build stage into nightly builds, running tests, packaging, deploying, etc.
22 +
23 +So in essence, the goal of maven is to automate even more of the whole build/test/install process then is currently done, even to the point of downloading software needed as part of the build. In addition, maven emphasizes //standards// over //configuration//. In WebObjects terms, that's a fancy way of saying that if you put your .wo files in Components, maven will know they need to go into the Resources folder in the .woa.
24 +
25 +So while you still have to provide maven with information on the dependencies, if you use the standard locations for things, you won't have to specify much else.
26 +
27 +=== A sample build ===
28 +
29 +So let's assume we have multiple frameworks and applications in our build. Each of these has some common ground, such as their dependencies on certain WebObjects frameworks, or the file layout, and of course they each may have something distinctive about them.
30 +
17 17  The layout of the frameworks and applications might look like this:
18 18  
19 19  {{noformat}}
... ... @@ -29,9 +29,9 @@
29 29  
30 30  {{/noformat}}
31 31  
32 -Our aim is twofold:
46 +This is a pretty standard way for many WO developers to group their projects. Framework projects go into frameworks, apps into apps. We can leverage that standard layout to accomplish two things:
33 33  
34 -1. put as much configuration as possible that's shared between all frameworks, for example, into /frameworks/pom.xml so we only have to define it once. The configuration is inherited by a child pom.
48 +1. put as much configuration as possible that's shared between all frameworks, for example, into /frameworks/pom.xml so we only have to define it once. The configuration is inherited by a child pom. This makes the child pom.xml files simpler.
35 35  1. Be able to issue a single command that will package each and every framework and application.
36 36  
37 37  === Key Concepts ===
... ... @@ -39,55 +39,29 @@
39 39  Typical things that make up a pom are as follows. (Note: only pom identification is mandatory. All the others have defaults.)
40 40  
41 41  1. pom identification (who am I?)
42 -The base triplet used to identify an artifact (i.e., product)
43 -
44 -{{noformat}}
45 -
56 + The base triplet used to identify an artifact (i.e., something you need to build/package/install)
57 +1. {{noformat}}
46 46   <artifactId>CustomExtensions</artifactId>
47 47   <groupId>com.mywostuff.frameworks</groupId>
48 48   <version>0.0.1-SNAPSHOT</version>
49 -
50 -
51 -{{/noformat}}
52 -
53 -1. pom packaging (i.e., what are we building?)
54 -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)
55 -
56 -{{noformat}}
57 -
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}}
58 58   <packaging>woapplication</artifactId>
59 -
60 -
61 -{{/noformat}}
62 -
63 -1. pom parent identification (who do I belong to?)
64 -
65 -{{noformat}}
66 -
65 +{{/noformat}}pom parent identification (who do I belong to?)
66 +1. {{noformat}}
67 67   <parent>
68 68   <artifactId>frameworks</artifactId>
69 69   <groupId>com.mywostuff</groupId>
70 70   </parent>
71 -
72 -
73 -{{/noformat}}
74 -
75 -1. modules (a.k.a kids; who belongs to me?)
76 -
77 -{{noformat}}
78 -
71 +{{/noformat}}modules (a.k.a kids; who belongs to me?)
72 +1. {{noformat}}
79 79   <modules>
80 80   <module>CustomExtensions</module>
81 81   <module>CustomBusinessLogic</module>
82 82   </modules>
83 -
84 -
85 -{{/noformat}}
86 -
87 -1. dependencies (what do I need?)
88 -
89 -{{noformat}}
90 -
77 +{{/noformat}}dependencies (what do I need?)
78 +1. {{noformat}}
91 91   <dependencies>
92 92   <dependency>
93 93   <groupId>log4j</groupId>
... ... @@ -102,11 +102,7 @@
102 102   <scope>test</scope>
103 103   </dependency>
104 104   </dependencies>
105 -
106 -
107 -{{/noformat}}
108 -
109 -1. build sources/resources (what do I have?)
93 +{{/noformat}}build sources/resources (what do I have?)
110 110  1. properties and filtering resources (variable definitions)
111 111  1. dependency/plugin management (shared configuration and versioning)
112 112  1. repositories (where to find dependencies and plugins)
... ... @@ -115,15 +115,13 @@
115 115  
116 116  === Alternate File System Layout Concepts ===
117 117  
118 -As you would (i.e., should) have read by now, Maven has what it calls //standards//. One such standard is the [[standard directory layout>>http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html_standard]]. One of the advantages of following the standards is that you get something for free: you have less to configure (or even almost nothing) in order to build a jar, for example, from your sources and resources. When that's not possible, options are available that allow you to //subvert// these standards or provide extra resouces.
102 +As you would (i.e., should) have read by now, Maven has what it calls //standards//. One such standard is the [[standard directory layout>>url:http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html_standard||shape="rect"]]. One of the advantages of following the standards is that you get something for free: you have less to configure (or even almost nothing) in order to build a jar, for example, from your sources and resources. When that's not possible, options are available that allow you to //subvert// these standards or provide extra resouces.
119 119  
120 120  {{tip title="Mavan Model Reference Doco"}}
121 -
122 -To see what built-in options are available for maven see [Maven Model|http://maven.apache.org/ref/2.0.9/maven-model/maven.html].
123 -
105 +To see what built-in options are available for maven see [[Maven Model>>url:http://maven.apache.org/ref/2.0.9/maven-model/maven.html||shape="rect"]].
124 124  {{/tip}}
125 125  
126 -The following roughly resembles the current WebObjects WOLips produced project layout (a.k.a Fluffy Bunny layout).
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).
127 127  
128 128  {{noformat}}
129 129  
... ... @@ -136,9 +136,9 @@
136 136  
137 137  {{/noformat}}
138 138  
139 -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. Notice we've also defined the target path for each resource. (See the [[Maven Model#class//resource//>>http://maven.apache.org/ref/2.0.9/maven-model/maven.html#class_resource]] for a definition of targetPath)
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)
140 140  
141 -{{code title="pom.xml"}}
123 +{{code title="pom.xml" 0="xml"}}
142 142  
143 143  <...>
144 144   <build>
... ... @@ -171,30 +171,526 @@
171 171  
172 172  === Project Dependencies Concepts ===
173 173  
174 -Most projects, of course, have dependencies on other libraries or frameworks.
156 +Most projects, of course, have dependencies on other libraries or frameworks. See the [[WOL:Maven Getting Started#How_do_I_use_external_dependencies>>url:http://maven.apache.org/guides/getting-started/index.html#How_do_I_use_external_dependencies||shape="rect"]].
175 175  
176 -=== Project Dependencies Prerequisites ===
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.
177 177  
178 -details to come...
160 +{{noformat}}
179 179  
162 + <dependencies>
163 + <dependency>
164 + <artifactId>CustomExtensions</artifactId>
165 + <groupId>com.mywostuff.frameworks</groupId>
166 + <version>0.0.1-SNAPSHOT</version>
167 + <scope>compile</scope>
168 + </dependency>
169 + <dependency>
170 + <groupId>log4j</groupId>
171 + <artifactId>log4j</artifactId>
172 + <version>1.2.12</version>
173 + <scope>compile</scope>
174 + </dependency>
175 + <dependency>
176 + <groupId>junit</groupId>
177 + <artifactId>junit</artifactId>
178 + <version>4.4</version>
179 + <scope>test</scope>
180 + </dependency>
181 + </dependencies>
182 +
183 +{{/noformat}}
184 +
185 +=== Project Inheritance ===
186 +
187 +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>>url:http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance||shape="rect"]] and [[Java World's The Maven 2 POM demystified>>url:http://www.javaworld.com/javaworld/jw-05-2006/jw-0529-maven.html||shape="rect"]] for further information and examples.
188 +
189 +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.
190 +
191 +=== Repositories ===
192 +
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 +
195 +{{noformat}}
196 +
197 +<repositories>
198 + <repository>
199 + <id>system-repo</id>
200 + <name>internal repository</name>
201 + <!-- TODO switch over to your intranet.domain -->
202 + <url>file://${user.home}/.myarchiva</url>
203 + <snapshots>
204 + <enabled>true</enabled>
205 + <updatePolicy>always</updatePolicy>
206 + <checksumPolicy>ignore</checksumPolicy>
207 + </snapshots>
208 + <releases>
209 + <enabled>true</enabled>
210 + <updatePolicy>always</updatePolicy>
211 + <checksumPolicy>ignore</checksumPolicy>
212 + </releases>
213 + </repository>
214 + <repository>
215 + <id>maven2-repository.dev.java.net</id>
216 + <name>Java.net Repository for Maven</name>
217 + <url>http://download.java.net/maven/2</url>
218 + <snapshots>
219 + <enabled>true</enabled>
220 + <updatePolicy>daily</updatePolicy>
221 + </snapshots>
222 + <releases>
223 + <enabled>true</enabled>
224 + <updatePolicy>daily</updatePolicy>
225 + </releases>
226 + </repository>
227 + <repository>
228 + <id>webobjects.mdimension.com/releases</id>
229 + <name>mdimension maven 2 releases repo</name>
230 + <url>http://webobjects.mdimension.com/maven2/releases</url>
231 + <snapshots>
232 + <enabled>false</enabled>
233 + </snapshots>
234 + <releases>
235 + <enabled>true</enabled>
236 + </releases>
237 + </repository>
238 + <repository>
239 + <id>webobjects.mdimension.com/snapshots</id>
240 + <name>mdimension maven 2 snapshots repo</name>
241 + <url>http://webobjects.mdimension.com/maven2/snapshots</url>
242 + <snapshots>
243 + <enabled>true</enabled>
244 + </snapshots>
245 + <releases>
246 + <enabled>false</enabled>
247 + </releases>
248 + </repository>
249 + <repository>
250 + <id>objectstyle-maven2</id>
251 + <name>objectstyle maven2 repo</name>
252 + <url>http://objectstyle.org/maven2</url>
253 + <snapshots>
254 + <enabled>false</enabled>
255 + </snapshots>
256 + <releases>
257 + <enabled>true</enabled>
258 + </releases>
259 + </repository>
260 +</repositories>
261 +
262 +{{/noformat}}
263 +
264 +Note: A remote repository is not guaranteed to keep older versions of libraries, for example, indefinitely. This is why it's recommended that you set up one for your intranet which stores what you need for longevity. See both the above intro to repositories and [[http:~~/~~/www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository>>url:http://www.theserverside.com/tt/articles/article.tss?l=SettingUpMavenRepository||shape="rect"]].
265 +
180 180  === Packaging Frameworks as Jars ===
181 181  
182 -details to come...
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):
183 183  
270 +{{attachments patterns="Info.plist" upload="false"/}}
271 +
272 +{{code title="/frameworks/pom.xml" 0="xml"}}
273 +
274 +<?xml version="1.0" encoding="UTF-8"?>
275 +<project xmlns="http://maven.apache.org/POM/4.0.0"
276 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
277 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
278 + http://maven.apache.org/xsd/maven-4.0.0.xsd">
279 +
280 + <modelVersion>4.0.0</modelVersion>
281 +
282 + <!-- parent artifact -->
283 + <parent>
284 + <artifactId>mywostuff</artifactId>
285 + <groupId>com</groupId>
286 + <version>1.0-SNAPSHOT</version>
287 + </parent>
288 +
289 + <!-- artifact identity -->
290 + <artifactId>frameworks</artifactId>
291 + <groupId>com.mywostuff</groupId>
292 + <packaging>pom</packaging>
293 +
294 + <!-- framework relevant properties -->
295 + <properties>
296 + <!-- NS related properties fills in Info.plist etc-->
297 + <CFBundleDevelopmentRegion>English</CFBundleDevelopmentRegion>
298 + <CFBundleGetInfoString></CFBundleGetInfoString>
299 + <CFBundlePackageType>FMWK</CFBundlePackageType>
300 + <CFBundleIconFile>WOAfile.icns</CFBundleIconFile>
301 + <CFBundleInfoDictionaryVersion>6.0</CFBundleInfoDictionaryVersion>
302 + <CFBundleVersion>5.3.1</CFBundleVersion>
303 + <Has_WOComponents>true</Has_WOComponents>
304 + <NSPrincipalClass>${mainclass}</NSPrincipalClass>
305 + <NSResourcesBundlePath></NSResourcesBundlePath>
306 + </properties>
307 +
308 + <!-- modules -->
309 + <modules>
310 + <module>CustomExtensions</module>
311 + <module>CustomBusinessLogic</module>
312 + </modules>
313 +
314 + <!-- specific dependencies (for modules) -->
315 + <dependencies>
316 + <dependency>
317 + <artifactId>ERExtensions</artifactId>
318 + <groupId>${wonder.common.groupId}</groupId>
319 + </dependency>
320 + <dependency>
321 + <artifactId>JavaWOExtensions</artifactId>
322 + <groupId>${wonder.common.groupId}</groupId>
323 + </dependency>
324 + <dependency>
325 + <artifactId>JavaFoundation</artifactId>
326 + <groupId>${webobjects.groupId}</groupId>
327 + </dependency>
328 + <dependency>
329 + <artifactId>JavaJDBCAdaptor</artifactId>
330 + <groupId>${webobjects.groupId}</groupId>
331 + </dependency>
332 + <dependency>
333 + <artifactId>JavaWebObjects</artifactId>
334 + <groupId>${webobjects.groupId}</groupId>
335 + </dependency>
336 + <dependency>
337 + <artifactId>JavaEOControl</artifactId>
338 + <groupId>${webobjects.groupId}</groupId>
339 + </dependency>
340 + <dependency>
341 + <artifactId>JavaEOAccess</artifactId>
342 + <groupId>${webobjects.groupId}</groupId>
343 + </dependency>
344 + <dependency>
345 + <artifactId>JavaWebObjects</artifactId>
346 + <groupId>${webobjects.groupId}</groupId>
347 + </dependency>
348 + <dependency>
349 + <artifactId>JavaXML</artifactId>
350 + <groupId>${webobjects.groupId}</groupId>
351 + </dependency>
352 + </dependencies>
353 +
354 +
355 + <!-- build config (for modules) -->
356 + <build>
357 + <sourceDirectory>src</sourceDirectory>
358 + <testSourceDirectory>tests</testSourceDirectory>
359 + <resources>
360 + <!-- relative dir for Info.plist -->
361 + <resource>
362 + <targetPath>Resources</targetPath>
363 + <filtering>true</filtering>
364 + <directory>../src/main/resources</directory>
365 + </resource>
366 + <resource>
367 + <targetPath>Resources</targetPath>
368 + <filtering>false</filtering>
369 + <directory>Components</directory>
370 + </resource>
371 + <resource>
372 + <targetPath>Resources</targetPath>
373 + <filtering>false</filtering>
374 + <directory>Resources</directory>
375 + </resource>
376 + <resource>
377 + <targetPath>WebServerResources</targetPath>
378 + <filtering>false</filtering>
379 + <directory>WebServerResources</directory>
380 + </resource>
381 + </resources>
382 + <plugins>
383 + <plugin>
384 + <groupId>org.apache.maven.plugins</groupId>
385 + <artifactId>maven-compiler-plugin</artifactId>
386 + <configuration>
387 + <source>${java.target}</source>
388 + <target>${java.target}</target>
389 + </configuration>
390 + </plugin>
391 + </plugins>
392 + </build>
393 +</project>
394 +
395 +{{/code}}
396 +
397 +Since our CustomExtensions has no further dependencies, its pom.xml merely specifies its parent and its identity.
398 +
399 +{{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}}
400 +
401 +<?xml version="1.0"?>
402 +<project>
403 + <!-- parent artifact -->
404 + <parent>
405 + <artifactId>frameworks</artifactId>
406 + <groupId>com.mywostuff</groupId>
407 + <version>1.0-SNAPSHOT</version>
408 + </parent>
409 +
410 + <!-- artifact identity -->
411 + <artifactId>CustomBusinessLogic</artifactId>
412 + <groupId>com.mywostuff.frameworks</groupId>
413 +</project>
414 +
415 +{{/code}}
416 +
417 +CustomBusinessLogic has a further dependency on CustomExtensions, so it specifies its parent, its identity, and the dependency.
418 +
419 +{{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}}
420 +
421 +<?xml version="1.0"?>
422 +<project>
423 + <!-- parent artifact -->
424 + <parent>
425 + <artifactId>frameworks</artifactId>
426 + <groupId>com.mywostuff</groupId>
427 + <version>1.0-SNAPSHOT</version>
428 + </parent>
429 +
430 + <!-- artifact identity -->
431 + <artifactId>CustomBusinessLogic</artifactId>
432 + <groupId>com.mywostuff.frameworks</groupId>
433 +
434 + <!-- specific dependencies -->
435 + <dependencies>
436 + <dependency>
437 + <artifactId>CustomExtensions</artifactId>
438 + <groupId>${pom.groupId}</groupId>
439 + </dependency>
440 + </dependencies>
441 +</project>
442 +
443 +{{/code}}
444 +
184 184  === Packaging Applications ===
185 185  
186 -details to come...
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.
187 187  
188 -=== Packaging Applications as True WAR ===
449 +{{code title="/apps/pom.xml" 0="xml"}}
189 189  
190 -You can find steps to package WO Applications as True WAR [[here>>Packaging WO Applications as true WAR with Maven]].
451 +<?xml version="1.0" encoding="UTF-8"?>
452 +<project xmlns="http://maven.apache.org/POM/4.0.0"
453 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
454 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
455 + http://maven.apache.org/xsd/maven-4.0.0.xsd">
191 191  
192 -more details to come...
457 + <modelVersion>4.0.0</modelVersion>
193 193  
194 -=== Project Inheritance ===
459 + <!-- parent artifact -->
460 + <parent>
461 + <groupId>com</groupId>
462 + <artifactId>mywostuff</artifactId>
463 + <version>1.0-SNAPSHOT</version>
464 + </parent>
195 195  
196 -details to come...
466 + <!-- artifact identity -->
467 + <artifactId>apps</artifactId>
468 + <groupId>com.mywostuff</groupId>
469 + <packaging>pom</packaging>
197 197  
471 + <!-- modules -->
472 + <modules>
473 + <module>ApplicationA</module>
474 + <module>ApplicationB</module>
475 + </modules>
476 +
477 + <!-- specific dependencies (for modules) -->
478 + <dependencies>
479 + <!-- wonder frameworks -->
480 + <dependency>
481 + <artifactId>ERExtensions</artifactId>
482 + <groupId>${wonder.common.groupId}</groupId>
483 + </dependency>
484 + <dependency>
485 + <artifactId>JavaWOExtensions</artifactId>
486 + <groupId>${wonder.common.groupId}</groupId>
487 + </dependency>
488 +
489 + <!-- project libs -->
490 + <dependency>
491 + <artifactId>CustomExtensions</artifactId>
492 + <groupId>${my.frameworks.groupId}</groupId>
493 + </dependency>
494 + <dependency>
495 + <artifactId>CustomBusinessLogic</artifactId>
496 + <groupId>${my.frameworks.groupId}</groupId>
497 + </dependency>
498 +
499 + <!-- webobjects dependencies -->
500 + <dependency>
501 + <artifactId>JavaFoundation</artifactId>
502 + <groupId>${webobjects.groupId}</groupId>
503 + </dependency>
504 + <dependency>
505 + <artifactId>JavaJDBCAdaptor</artifactId>
506 + <groupId>${webobjects.groupId}</groupId>
507 + </dependency>
508 + <dependency>
509 + <artifactId>JavaWebObjects</artifactId>
510 + <groupId>${webobjects.groupId}</groupId>
511 + </dependency>
512 + <dependency>
513 + <artifactId>JavaEOControl</artifactId>
514 + <groupId>${webobjects.groupId}</groupId>
515 + </dependency>
516 + <dependency>
517 + <artifactId>JavaEOAccess</artifactId>
518 + <groupId>${webobjects.groupId}</groupId>
519 + </dependency>
520 + <dependency>
521 + <artifactId>JavaWebObjects</artifactId>
522 + <groupId>${webobjects.groupId}</groupId>
523 + </dependency>
524 + <dependency>
525 + <artifactId>JavaXML</artifactId>
526 + <groupId>${webobjects.groupId}</groupId>
527 + </dependency>
528 + </dependencies>
529 +
530 + <!-- build config (for modules) -->
531 + <build>
532 + <sourceDirectory>src</sourceDirectory>
533 + <testSourceDirectory>tests</testSourceDirectory>
534 + <resources>
535 + <resource>
536 + <targetPath>Resources</targetPath>
537 + <filtering>false</filtering>
538 + <directory>Components</directory>
539 + </resource>
540 + <resource>
541 + <targetPath>Resources</targetPath>
542 + <filtering>false</filtering>
543 + <directory>Resources</directory>
544 + </resource>
545 + <resource>
546 + <targetPath>WebServerResources</targetPath>
547 + <filtering>false</filtering>
548 + <directory>WebServerResources</directory>
549 + </resource>
550 + </resources>
551 + <plugins>
552 + <plugin>
553 + <artifactId>maven-wolifecycle-plugin</artifactId>
554 + <groupId>org.objectstyle.woproject.maven2</groupId>
555 + <version>2.0.15</version>
556 + <extensions>true</extensions>
557 + <configuration>
558 + <source>${java.target}</source>
559 + <target>${java.target}</target>
560 + </configuration>
561 + </plugin>
562 + <plugin>
563 + <groupId>org.apache.maven.plugins</groupId>
564 + <artifactId>maven-javadoc-plugin</artifactId>
565 + <configuration>
566 + <javadocVersion>${java.target}</javadocVersion>
567 + <locale>en-AU</locale>
568 + <minmemory>128m</minmemory>
569 + <maxmemory>512m</maxmemory>
570 + </configuration>
571 + </plugin>
572 + <!--
573 + TODO build numbering
574 + <plugin>
575 + <groupId>org.codehaus.mojo</groupId>
576 + <artifactId>maven-buildnumber-plugin</artifactId>
577 + <version>0.9.6</version>
578 + <executions>
579 + <execution>
580 + <phase>validate</phase>
581 + <goals>
582 + <goal>create</goal>
583 + </goals>
584 + </execution>
585 + </executions>
586 + <configuration>
587 + <doCheck>true</doCheck>
588 + <doUpdate>true</doUpdate>
589 + </configuration>
590 + </plugin>
591 + -->
592 + </plugins>
593 + <pluginManagement>
594 + <plugins>
595 + <plugin>
596 + <groupId>org.apache.maven.plugins</groupId>
597 + <artifactId>maven-compiler-plugin</artifactId>
598 + <configuration>
599 + <source>${java.target}</source>
600 + <target>${java.target}</target>
601 + </configuration>
602 + </plugin>
603 + </plugins>
604 + </pluginManagement>
605 + </build>
606 +</project>
607 +
608 +{{/code}}
609 +
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 +
612 +{{code title="/apps/ApplicationA/pom.xml" 0="xml"}}
613 +
614 +<?xml version="1.0"?>
615 +<project>
616 + <modelVersion>4.0.0</modelVersion>
617 +
618 + <!-- parent artifact -->
619 + <parent>
620 + <artifactId>apps</artifactId>
621 + <groupId>com.mywostuff</groupId>
622 + <version>1.0-SNAPSHOT</version>
623 + <relativePath>../apps</relativePath> <!-- e.g., (optional) if your app is under /trunk -->
624 + </parent>
625 +
626 + <!-- artifact identity -->
627 + <artifactId>ApplicationA</artifactId>
628 + <groupId>com.mywostuff.apps</groupId>
629 + <packaging>woapplication</packaging> <!-- woproject specific packaging -->
630 +
631 + <!-- specific properties -->
632 + <properties>
633 + <!-- general properties -->
634 + <mainclass>your.app.Application</mainclass>
635 + </properties>
636 +
637 + <!-- specific dependencies -->
638 + <dependencies>
639 + <!-- wonder frameworks -->
640 + <dependency>
641 + <artifactId>Ajax</artifactId>
642 + <groupId>${wonder.ajax.groupId}</groupId>
643 + </dependency>
644 + <dependency>
645 + <artifactId>ERCaptcha</artifactId>
646 + <groupId>${wonder.common.groupId}</groupId>
647 + <!-- requires jcaptcha-all below -->
648 + </dependency>
649 + <dependency>
650 + <artifactId>WOOgnl</artifactId>
651 + <groupId>${wonder.common.groupId}</groupId>
652 + </dependency>
653 +
654 + <!-- general libs -->
655 + <dependency>
656 + <artifactId>jcaptcha-all</artifactId>
657 + <groupId>com.octo.captcha</groupId>
658 + </dependency>
659 + <dependency>
660 + <artifactId>commons-collections</artifactId>
661 + <groupId>commons-collections</groupId>
662 + </dependency>
663 + <dependency>
664 + <groupId>ognl</groupId>
665 + <artifactId>ognl</artifactId>
666 + </dependency>
667 + </dependencies>
668 +</project>
669 +
670 +{{/code}}
671 +
672 +=== Packaging Applications as True WAR ===
673 +
674 +You can find steps to package WO Applications as True WAR [[here>>doc:WOL.Packaging WO Applications as true WAR with Maven]].
675 +
198 198  === Eclipse Integration ===
199 199  
200 200  details to come...