Version 27.1 by pierce on 2008/07/03 14:25

Hide last authors
Henrique Prange 18.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.
Lachlan Deck 5.1 2
Henrique Prange 18.1 3 {{info title="Recommended Homework (or pre-requisites)"}}
pierce 27.1 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"]].
Lachlan Deck 5.1 5
pierce 27.1 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"]].
Henrique Prange 18.1 7
pierce 27.1 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"]].
Henrique Prange 18.1 9 {{/info}}
10
Lachlan Deck 20.1 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}}
14
pierce 27.1 15 === Why Maven ===
Henrique Prange 18.1 16
pierce 27.1 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.
Henrique Prange 18.1 18
pierce 27.1 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.
20
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
Henrique Prange 18.1 31 The layout of the frameworks and applications might look like this:
32
33 {{noformat}}
34
35 /trunk/
36 /trunk/apps/
37 /trunk/apps/ApplicationA/
38 /trunk/apps/ApplicationB/
39 /trunk/frameworks/
40 /trunk/frameworks/CustomExtensions/
41 /trunk/frameworks/CustomBusinessLogic/
42 /trunk/frameworks/etc/
43
44 {{/noformat}}
45
pierce 27.1 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:
Henrique Prange 18.1 47
pierce 27.1 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.
Henrique Prange 18.1 49 1. Be able to issue a single command that will package each and every framework and application.
50
51 === Key Concepts ===
52
53 Typical things that make up a pom are as follows. (Note: only pom identification is mandatory. All the others have defaults.)
54
55 1. pom identification (who am I?)
pierce 27.1 56 The base triplet used to identify an artifact (i.e., something you need to build/package/install)
57 1. {{noformat}}
Henrique Prange 18.1 58 <artifactId>CustomExtensions</artifactId>
59 <groupId>com.mywostuff.frameworks</groupId>
60 <version>0.0.1-SNAPSHOT</version>
pierce 27.1 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}}
Henrique Prange 18.1 64 <packaging>woapplication</artifactId>
pierce 27.1 65 {{/noformat}}pom parent identification (who do I belong to?)
66 1. {{noformat}}
Henrique Prange 18.1 67 <parent>
68 <artifactId>frameworks</artifactId>
69 <groupId>com.mywostuff</groupId>
70 </parent>
pierce 27.1 71 {{/noformat}}modules (a.k.a kids; who belongs to me?)
72 1. {{noformat}}
Henrique Prange 18.1 73 <modules>
74 <module>CustomExtensions</module>
75 <module>CustomBusinessLogic</module>
76 </modules>
pierce 27.1 77 {{/noformat}}dependencies (what do I need?)
78 1. {{noformat}}
Henrique Prange 18.1 79 <dependencies>
80 <dependency>
81 <groupId>log4j</groupId>
82 <artifactId>log4j</artifactId>
83 <version>1.2.12</version>
84 <scope>compile</scope>
85 </dependency>
86 <dependency>
87 <groupId>junit</groupId>
88 <artifactId>junit</artifactId>
89 <version>4.4</version>
90 <scope>test</scope>
91 </dependency>
92 </dependencies>
pierce 27.1 93 {{/noformat}}build sources/resources (what do I have?)
Henrique Prange 18.1 94 1. properties and filtering resources (variable definitions)
95 1. dependency/plugin management (shared configuration and versioning)
96 1. repositories (where to find dependencies and plugins)
97
98 Of course, with the plethora of plugins available for maven, this is only the tip of the iceberg. However, these main concepts will suffice for now.
99
100 === Alternate File System Layout Concepts ===
101
pierce 27.1 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.
Henrique Prange 18.1 103
104 {{tip title="Mavan Model Reference Doco"}}
pierce 27.1 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"]].
Henrique Prange 18.1 106 {{/tip}}
107
pierce 27.1 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).
Henrique Prange 18.1 109
110 {{noformat}}
111
112 /MyProject
113 /MyProject/Components
114 /MyProject/Resources
115 /MyProject/Sources
116 /MyProject/Tests
117 /MyProject/WebServerResources
118
119 {{/noformat}}
120
pierce 27.1 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)
Henrique Prange 18.1 122
pierce 27.1 123 {{code title="pom.xml" 0="xml"}}
Lachlan Deck 5.1 124
125 <...>
126 <build>
Henrique Prange 18.1 127 <sourceDirectory>Sources</sourceDirectory>
128 <testSourceDirectory>Tests</testSourceDirectory>
Lachlan Deck 5.1 129 <resources>
130 <resource>
Henrique Prange 18.1 131 <targetPath>Resources</targetPath>
132 <filtering>false</filtering>
133 <directory>Components</directory>
Lachlan Deck 5.1 134 </resource>
Henrique Prange 18.1 135 <resource>
136 <targetPath>Resources</targetPath>
137 <filtering>false</filtering>
138 <directory>Resources</directory>
139 </resource>
140 <resource>
141 <targetPath>WebServerResources</targetPath>
142 <filtering>false</filtering>
143 <directory>WebServerResources</directory>
144 </resource>
Lachlan Deck 5.1 145 </resources>
Henrique Prange 18.1 146 <...>
Lachlan Deck 5.1 147 </build>
148 <...>
149
150 {{/code}}
151
Henrique Prange 18.1 152 So, concentrating on our frameworks alone for the moment, assuming all of your frameworks share the above project layout the above can happily go into your /frameworks/pom.xml file and as such be shared by all sub-modules (i.e., frameworks).
153
154 === Project Dependencies Concepts ===
155
pierce 27.1 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"]].
Henrique Prange 18.1 157
pierce 27.1 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.
Henrique Prange 18.1 159
Lachlan Deck 20.1 160 {{noformat}}
Henrique Prange 18.1 161
Lachlan Deck 20.1 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
Lachlan Deck 23.1 185 === Project Inheritance ===
186
pierce 27.1 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.
Lachlan Deck 23.1 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
Lachlan Deck 20.1 191 === Repositories ===
192
pierce 27.1 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.
Lachlan Deck 20.1 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
pierce 27.1 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"]].
Lachlan Deck 20.1 265
Henrique Prange 18.1 266 === Packaging Frameworks as Jars ===
267
pierce 27.1 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):
Henrique Prange 18.1 269
pierce 27.1 270 {{attachments patterns="Info.plist" upload="false"/}}
Lachlan Deck 23.1 271
pierce 27.1 272 {{code title="/frameworks/pom.xml" 0="xml"}}
Lachlan Deck 20.1 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>
Lachlan Deck 23.1 281
Lachlan Deck 20.1 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>
Lachlan Deck 23.1 293
Lachlan Deck 20.1 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
pierce 27.1 397 Since our CustomExtensions has no further dependencies, its pom.xml merely specifies its parent and its identity.
Lachlan Deck 20.1 398
pierce 27.1 399 {{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}}
Lachlan Deck 20.1 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
pierce 27.1 417 CustomBusinessLogic has a further dependency on CustomExtensions, so it specifies its parent, its identity, and the dependency.
Lachlan Deck 20.1 418
pierce 27.1 419 {{code title="/frameworks/CustomBusinessLogic/pom.xml" 0="xml"}}
Lachlan Deck 20.1 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>
Lachlan Deck 23.1 433
Lachlan Deck 20.1 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
Henrique Prange 18.1 445 === Packaging Applications ===
446
pierce 27.1 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.
Henrique Prange 18.1 448
pierce 27.1 449 {{code title="/apps/pom.xml" 0="xml"}}
Henrique Prange 18.1 450
Lachlan Deck 23.1 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">
Henrique Prange 18.1 456
Lachlan Deck 23.1 457 <modelVersion>4.0.0</modelVersion>
Henrique Prange 18.1 458
Lachlan Deck 23.1 459 <!-- parent artifact -->
460 <parent>
461 <groupId>com</groupId>
462 <artifactId>mywostuff</artifactId>
463 <version>1.0-SNAPSHOT</version>
464 </parent>
Henrique Prange 18.1 465
Lachlan Deck 23.1 466 <!-- artifact identity -->
467 <artifactId>apps</artifactId>
468 <groupId>com.mywostuff</groupId>
469 <packaging>pom</packaging>
Henrique Prange 18.1 470
Lachlan Deck 23.1 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
pierce 27.1 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.
Lachlan Deck 23.1 611
pierce 27.1 612 {{code title="/apps/ApplicationA/pom.xml" 0="xml"}}
Lachlan Deck 23.1 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
pierce 27.1 674 You can find steps to package WO Applications as True WAR [[here>>doc:WOL.Packaging WO Applications as true WAR with Maven]].
Lachlan Deck 23.1 675
Henrique Prange 18.1 676 === Eclipse Integration ===
677
678 details to come...
679
680 === Putting It All Together ===
681
682 details to come...