Wiki source code of Maven Kicking the tyres without changing your project structure
Version 26.1 by Lachlan Deck on 2008/07/03 00:07
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
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. |
![]() |
5.1 | 2 | |
![]() |
18.1 | 3 | {{info title="Recommended Homework (or pre-requisites)"}} |
![]() |
5.1 | 4 | |
![]() |
18.1 | 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 | |||
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 | |||
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]. | ||
10 | |||
11 | {{/info}} | ||
12 | |||
![]() |
20.1 | 13 | {{tip title="Hang in there"}} |
14 | |||
15 | This particular guide might look long but some of the xml is duplicated a few times to show differing examples. | ||
16 | |||
17 | {{/tip}} | ||
18 | |||
![]() |
18.1 | 19 | === What's the aim === |
20 | |||
21 | 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. | ||
22 | |||
23 | The layout of the frameworks and applications might look like this: | ||
24 | |||
25 | {{noformat}} | ||
26 | |||
27 | /trunk/ | ||
28 | /trunk/apps/ | ||
29 | /trunk/apps/ApplicationA/ | ||
30 | /trunk/apps/ApplicationB/ | ||
31 | /trunk/frameworks/ | ||
32 | /trunk/frameworks/CustomExtensions/ | ||
33 | /trunk/frameworks/CustomBusinessLogic/ | ||
34 | /trunk/frameworks/etc/ | ||
35 | |||
36 | {{/noformat}} | ||
37 | |||
38 | Our aim is twofold: | ||
39 | |||
40 | 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. | ||
41 | 1. Be able to issue a single command that will package each and every framework and application. | ||
42 | |||
43 | === Key Concepts === | ||
44 | |||
45 | Typical things that make up a pom are as follows. (Note: only pom identification is mandatory. All the others have defaults.) | ||
46 | |||
47 | 1. pom identification (who am I?) | ||
48 | The base triplet used to identify an artifact (i.e., product) | ||
49 | |||
50 | {{noformat}} | ||
51 | |||
52 | <artifactId>CustomExtensions</artifactId> | ||
53 | <groupId>com.mywostuff.frameworks</groupId> | ||
54 | <version>0.0.1-SNAPSHOT</version> | ||
55 | |||
56 | {{/noformat}} | ||
57 | |||
58 | 1. pom packaging (i.e., what are we building?) | ||
59 | 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) | ||
60 | |||
61 | {{noformat}} | ||
62 | |||
63 | <packaging>woapplication</artifactId> | ||
64 | |||
65 | {{/noformat}} | ||
66 | |||
67 | 1. pom parent identification (who do I belong to?) | ||
68 | |||
69 | {{noformat}} | ||
70 | |||
71 | <parent> | ||
72 | <artifactId>frameworks</artifactId> | ||
73 | <groupId>com.mywostuff</groupId> | ||
74 | </parent> | ||
75 | |||
76 | {{/noformat}} | ||
77 | |||
78 | 1. modules (a.k.a kids; who belongs to me?) | ||
79 | |||
80 | {{noformat}} | ||
81 | |||
82 | <modules> | ||
83 | <module>CustomExtensions</module> | ||
84 | <module>CustomBusinessLogic</module> | ||
85 | </modules> | ||
86 | |||
87 | {{/noformat}} | ||
88 | |||
89 | 1. dependencies (what do I need?) | ||
90 | |||
91 | {{noformat}} | ||
92 | |||
93 | <dependencies> | ||
94 | <dependency> | ||
95 | <groupId>log4j</groupId> | ||
96 | <artifactId>log4j</artifactId> | ||
97 | <version>1.2.12</version> | ||
98 | <scope>compile</scope> | ||
99 | </dependency> | ||
100 | <dependency> | ||
101 | <groupId>junit</groupId> | ||
102 | <artifactId>junit</artifactId> | ||
103 | <version>4.4</version> | ||
104 | <scope>test</scope> | ||
105 | </dependency> | ||
106 | </dependencies> | ||
107 | |||
108 | {{/noformat}} | ||
109 | |||
110 | 1. build sources/resources (what do I have?) | ||
111 | 1. properties and filtering resources (variable definitions) | ||
112 | 1. dependency/plugin management (shared configuration and versioning) | ||
113 | 1. repositories (where to find dependencies and plugins) | ||
114 | |||
115 | 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. | ||
116 | |||
117 | === Alternate File System Layout Concepts === | ||
118 | |||
119 | 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. | ||
120 | |||
121 | {{tip title="Mavan Model Reference Doco"}} | ||
122 | |||
123 | 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]. | ||
124 | |||
125 | {{/tip}} | ||
126 | |||
127 | The following roughly resembles the current WebObjects WOLips produced project layout (a.k.a Fluffy Bunny layout). | ||
128 | |||
129 | {{noformat}} | ||
130 | |||
131 | /MyProject | ||
132 | /MyProject/Components | ||
133 | /MyProject/Resources | ||
134 | /MyProject/Sources | ||
135 | /MyProject/Tests | ||
136 | /MyProject/WebServerResources | ||
137 | |||
138 | {{/noformat}} | ||
139 | |||
140 | 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) | ||
141 | |||
![]() |
5.1 | 142 | {{code title="pom.xml"}} |
143 | |||
144 | <...> | ||
145 | <build> | ||
![]() |
18.1 | 146 | <sourceDirectory>Sources</sourceDirectory> |
147 | <testSourceDirectory>Tests</testSourceDirectory> | ||
![]() |
5.1 | 148 | <resources> |
149 | <resource> | ||
![]() |
18.1 | 150 | <targetPath>Resources</targetPath> |
151 | <filtering>false</filtering> | ||
152 | <directory>Components</directory> | ||
![]() |
5.1 | 153 | </resource> |
![]() |
18.1 | 154 | <resource> |
155 | <targetPath>Resources</targetPath> | ||
156 | <filtering>false</filtering> | ||
157 | <directory>Resources</directory> | ||
158 | </resource> | ||
159 | <resource> | ||
160 | <targetPath>WebServerResources</targetPath> | ||
161 | <filtering>false</filtering> | ||
162 | <directory>WebServerResources</directory> | ||
163 | </resource> | ||
![]() |
5.1 | 164 | </resources> |
![]() |
18.1 | 165 | <...> |
![]() |
5.1 | 166 | </build> |
167 | <...> | ||
168 | |||
169 | {{/code}} | ||
170 | |||
![]() |
18.1 | 171 | 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). |
172 | |||
173 | === Project Dependencies Concepts === | ||
174 | |||
![]() |
20.1 | 175 | Most projects, of course, have dependencies on other libraries or frameworks. See the [[Maven Getting Started#How//do//I//use//external//dependencies//>>http://maven.apache.org/guides/getting-started/index.html#How_do_I_use_external_dependencies]]. |
![]() |
18.1 | 176 | |
![]() |
20.1 | 177 | 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 [[Maven Model#class//dependency//>>http://maven.apache.org/ref/2.0.9/maven-model/maven.html#class_dependency]] for specific definitions. |
![]() |
18.1 | 178 | |
![]() |
20.1 | 179 | {{noformat}} |
![]() |
18.1 | 180 | |
![]() |
20.1 | 181 | <dependencies> |
182 | <dependency> | ||
183 | <artifactId>CustomExtensions</artifactId> | ||
184 | <groupId>com.mywostuff.frameworks</groupId> | ||
185 | <version>0.0.1-SNAPSHOT</version> | ||
186 | <scope>compile</scope> | ||
187 | </dependency> | ||
188 | <dependency> | ||
189 | <groupId>log4j</groupId> | ||
190 | <artifactId>log4j</artifactId> | ||
191 | <version>1.2.12</version> | ||
192 | <scope>compile</scope> | ||
193 | </dependency> | ||
194 | <dependency> | ||
195 | <groupId>junit</groupId> | ||
196 | <artifactId>junit</artifactId> | ||
197 | <version>4.4</version> | ||
198 | <scope>test</scope> | ||
199 | </dependency> | ||
200 | </dependencies> | ||
201 | |||
202 | {{/noformat}} | ||
203 | |||
![]() |
23.1 | 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 | |||
![]() |
20.1 | 210 | === Repositories === |
211 | |||
![]() |
23.1 | 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]]. |
![]() |
20.1 | 213 | |
214 | {{noformat}} | ||
215 | |||
216 | <repositories> | ||
217 | <repository> | ||
218 | <id>system-repo</id> | ||
219 | <name>internal repository</name> | ||
220 | <!-- TODO switch over to your intranet.domain --> | ||
221 | <url>file://${user.home}/.myarchiva</url> | ||
222 | <snapshots> | ||
223 | <enabled>true</enabled> | ||
224 | <updatePolicy>always</updatePolicy> | ||
225 | <checksumPolicy>ignore</checksumPolicy> | ||
226 | </snapshots> | ||
227 | <releases> | ||
228 | <enabled>true</enabled> | ||
229 | <updatePolicy>always</updatePolicy> | ||
230 | <checksumPolicy>ignore</checksumPolicy> | ||
231 | </releases> | ||
232 | </repository> | ||
233 | <repository> | ||
234 | <id>maven2-repository.dev.java.net</id> | ||
235 | <name>Java.net Repository for Maven</name> | ||
236 | <url>http://download.java.net/maven/2</url> | ||
237 | <snapshots> | ||
238 | <enabled>true</enabled> | ||
239 | <updatePolicy>daily</updatePolicy> | ||
240 | </snapshots> | ||
241 | <releases> | ||
242 | <enabled>true</enabled> | ||
243 | <updatePolicy>daily</updatePolicy> | ||
244 | </releases> | ||
245 | </repository> | ||
246 | <repository> | ||
247 | <id>webobjects.mdimension.com/releases</id> | ||
248 | <name>mdimension maven 2 releases repo</name> | ||
249 | <url>http://webobjects.mdimension.com/maven2/releases</url> | ||
250 | <snapshots> | ||
251 | <enabled>false</enabled> | ||
252 | </snapshots> | ||
253 | <releases> | ||
254 | <enabled>true</enabled> | ||
255 | </releases> | ||
256 | </repository> | ||
257 | <repository> | ||
258 | <id>webobjects.mdimension.com/snapshots</id> | ||
259 | <name>mdimension maven 2 snapshots repo</name> | ||
260 | <url>http://webobjects.mdimension.com/maven2/snapshots</url> | ||
261 | <snapshots> | ||
262 | <enabled>true</enabled> | ||
263 | </snapshots> | ||
264 | <releases> | ||
265 | <enabled>false</enabled> | ||
266 | </releases> | ||
267 | </repository> | ||
268 | <repository> | ||
269 | <id>objectstyle-maven2</id> | ||
270 | <name>objectstyle maven2 repo</name> | ||
271 | <url>http://objectstyle.org/maven2</url> | ||
272 | <snapshots> | ||
273 | <enabled>false</enabled> | ||
274 | </snapshots> | ||
275 | <releases> | ||
276 | <enabled>true</enabled> | ||
277 | </releases> | ||
278 | </repository> | ||
279 | </repositories> | ||
280 | |||
281 | {{/noformat}} | ||
282 | |||
283 | Note: A remote repository is not guaranteed to keep older versions of libraries, for example, indefinitely. 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]]. | ||
284 | |||
![]() |
18.1 | 285 | === Packaging Frameworks as Jars === |
286 | |||
![]() |
23.1 | 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: |
![]() |
18.1 | 288 | |
![]() |
23.1 | 289 | {{attachments patterns="Info.plist" upload="false"}}{{/attachments}} |
290 | |||
![]() |
20.1 | 291 | {{code title="/frameworks/pom.xml"}} |
292 | |||
293 | <?xml version="1.0" encoding="UTF-8"?> | ||
294 | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
295 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
296 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | ||
297 | http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
298 | |||
299 | <modelVersion>4.0.0</modelVersion> | ||
![]() |
23.1 | 300 | |
![]() |
20.1 | 301 | <!-- parent artifact --> |
302 | <parent> | ||
303 | <artifactId>mywostuff</artifactId> | ||
304 | <groupId>com</groupId> | ||
305 | <version>1.0-SNAPSHOT</version> | ||
306 | </parent> | ||
307 | |||
308 | <!-- artifact identity --> | ||
309 | <artifactId>frameworks</artifactId> | ||
310 | <groupId>com.mywostuff</groupId> | ||
311 | <packaging>pom</packaging> | ||
![]() |
23.1 | 312 | |
![]() |
20.1 | 313 | <!-- framework relevant properties --> |
314 | <properties> | ||
315 | <!-- NS related properties fills in Info.plist etc--> | ||
316 | <CFBundleDevelopmentRegion>English</CFBundleDevelopmentRegion> | ||
317 | <CFBundleGetInfoString></CFBundleGetInfoString> | ||
318 | <CFBundlePackageType>FMWK</CFBundlePackageType> | ||
319 | <CFBundleIconFile>WOAfile.icns</CFBundleIconFile> | ||
320 | <CFBundleInfoDictionaryVersion>6.0</CFBundleInfoDictionaryVersion> | ||
321 | <CFBundleVersion>5.3.1</CFBundleVersion> | ||
322 | <Has_WOComponents>true</Has_WOComponents> | ||
323 | <NSPrincipalClass>${mainclass}</NSPrincipalClass> | ||
324 | <NSResourcesBundlePath></NSResourcesBundlePath> | ||
325 | </properties> | ||
326 | |||
327 | <!-- modules --> | ||
328 | <modules> | ||
329 | <module>CustomExtensions</module> | ||
330 | <module>CustomBusinessLogic</module> | ||
331 | </modules> | ||
332 | |||
333 | <!-- specific dependencies (for modules) --> | ||
334 | <dependencies> | ||
335 | <dependency> | ||
336 | <artifactId>ERExtensions</artifactId> | ||
337 | <groupId>${wonder.common.groupId}</groupId> | ||
338 | </dependency> | ||
339 | <dependency> | ||
340 | <artifactId>JavaWOExtensions</artifactId> | ||
341 | <groupId>${wonder.common.groupId}</groupId> | ||
342 | </dependency> | ||
343 | <dependency> | ||
344 | <artifactId>JavaFoundation</artifactId> | ||
345 | <groupId>${webobjects.groupId}</groupId> | ||
346 | </dependency> | ||
347 | <dependency> | ||
348 | <artifactId>JavaJDBCAdaptor</artifactId> | ||
349 | <groupId>${webobjects.groupId}</groupId> | ||
350 | </dependency> | ||
351 | <dependency> | ||
352 | <artifactId>JavaWebObjects</artifactId> | ||
353 | <groupId>${webobjects.groupId}</groupId> | ||
354 | </dependency> | ||
355 | <dependency> | ||
356 | <artifactId>JavaEOControl</artifactId> | ||
357 | <groupId>${webobjects.groupId}</groupId> | ||
358 | </dependency> | ||
359 | <dependency> | ||
360 | <artifactId>JavaEOAccess</artifactId> | ||
361 | <groupId>${webobjects.groupId}</groupId> | ||
362 | </dependency> | ||
363 | <dependency> | ||
364 | <artifactId>JavaWebObjects</artifactId> | ||
365 | <groupId>${webobjects.groupId}</groupId> | ||
366 | </dependency> | ||
367 | <dependency> | ||
368 | <artifactId>JavaXML</artifactId> | ||
369 | <groupId>${webobjects.groupId}</groupId> | ||
370 | </dependency> | ||
371 | </dependencies> | ||
372 | |||
373 | |||
374 | <!-- build config (for modules) --> | ||
375 | <build> | ||
376 | <sourceDirectory>src</sourceDirectory> | ||
377 | <testSourceDirectory>tests</testSourceDirectory> | ||
378 | <resources> | ||
379 | <!-- relative dir for Info.plist --> | ||
380 | <resource> | ||
381 | <targetPath>Resources</targetPath> | ||
382 | <filtering>true</filtering> | ||
383 | <directory>../src/main/resources</directory> | ||
384 | </resource> | ||
385 | <resource> | ||
386 | <targetPath>Resources</targetPath> | ||
387 | <filtering>false</filtering> | ||
388 | <directory>Components</directory> | ||
389 | </resource> | ||
390 | <resource> | ||
391 | <targetPath>Resources</targetPath> | ||
392 | <filtering>false</filtering> | ||
393 | <directory>Resources</directory> | ||
394 | </resource> | ||
395 | <resource> | ||
396 | <targetPath>WebServerResources</targetPath> | ||
397 | <filtering>false</filtering> | ||
398 | <directory>WebServerResources</directory> | ||
399 | </resource> | ||
400 | </resources> | ||
401 | <plugins> | ||
402 | <plugin> | ||
403 | <groupId>org.apache.maven.plugins</groupId> | ||
404 | <artifactId>maven-compiler-plugin</artifactId> | ||
405 | <configuration> | ||
406 | <source>${java.target}</source> | ||
407 | <target>${java.target}</target> | ||
408 | </configuration> | ||
409 | </plugin> | ||
410 | </plugins> | ||
411 | </build> | ||
412 | </project> | ||
413 | |||
414 | {{/code}} | ||
415 | |||
416 | and CustomExtensions which has no further dependencies | ||
417 | |||
418 | {{code title="/frameworks/CustomBusinessLogic/pom.xml"}} | ||
419 | |||
420 | <?xml version="1.0"?> | ||
421 | <project> | ||
422 | <!-- parent artifact --> | ||
423 | <parent> | ||
424 | <artifactId>frameworks</artifactId> | ||
425 | <groupId>com.mywostuff</groupId> | ||
426 | <version>1.0-SNAPSHOT</version> | ||
427 | </parent> | ||
428 | |||
429 | <!-- artifact identity --> | ||
430 | <artifactId>CustomBusinessLogic</artifactId> | ||
431 | <groupId>com.mywostuff.frameworks</groupId> | ||
432 | </project> | ||
433 | |||
434 | {{/code}} | ||
435 | |||
436 | and CustomBusinessLogic (which has a further dependency on CustomExtensions) | ||
437 | |||
438 | {{code title="/frameworks/CustomBusinessLogic/pom.xml"}} | ||
439 | |||
440 | <?xml version="1.0"?> | ||
441 | <project> | ||
442 | <!-- parent artifact --> | ||
443 | <parent> | ||
444 | <artifactId>frameworks</artifactId> | ||
445 | <groupId>com.mywostuff</groupId> | ||
446 | <version>1.0-SNAPSHOT</version> | ||
447 | </parent> | ||
448 | |||
449 | <!-- artifact identity --> | ||
450 | <artifactId>CustomBusinessLogic</artifactId> | ||
451 | <groupId>com.mywostuff.frameworks</groupId> | ||
![]() |
23.1 | 452 | |
![]() |
20.1 | 453 | <!-- specific dependencies --> |
454 | <dependencies> | ||
455 | <dependency> | ||
456 | <artifactId>CustomExtensions</artifactId> | ||
457 | <groupId>${pom.groupId}</groupId> | ||
458 | </dependency> | ||
459 | </dependencies> | ||
460 | </project> | ||
461 | |||
462 | {{/code}} | ||
463 | |||
![]() |
18.1 | 464 | === Packaging Applications === |
465 | |||
![]() |
23.1 | 466 | Here's the definition for /apps/pom.xml which is shared by any sub-modules (i.e., ApplicationA and ApplicationB). |
![]() |
18.1 | 467 | |
![]() |
23.1 | 468 | {{code title="/apps/pom.xml"}} |
![]() |
18.1 | 469 | |
![]() |
23.1 | 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"> | ||
![]() |
18.1 | 475 | |
![]() |
23.1 | 476 | <modelVersion>4.0.0</modelVersion> |
![]() |
18.1 | 477 | |
![]() |
23.1 | 478 | <!-- parent artifact --> |
479 | <parent> | ||
480 | <groupId>com</groupId> | ||
481 | <artifactId>mywostuff</artifactId> | ||
482 | <version>1.0-SNAPSHOT</version> | ||
483 | </parent> | ||
![]() |
18.1 | 484 | |
![]() |
23.1 | 485 | <!-- artifact identity --> |
486 | <artifactId>apps</artifactId> | ||
487 | <groupId>com.mywostuff</groupId> | ||
488 | <packaging>pom</packaging> | ||
![]() |
18.1 | 489 | |
![]() |
23.1 | 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 | |||
![]() |
18.1 | 695 | === Eclipse Integration === |
696 | |||
697 | details to come... | ||
698 | |||
699 | === Putting It All Together === | ||
700 | |||
701 | details to come... |