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

From version 15.1
edited by Lachlan Deck
on 2008/06/15 04:51
Change comment: Fleshing it out some more. Still a work in progress.
To version 16.1
edited by Lachlan Deck
on 2008/06/11 19:46
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,131 +1,35 @@
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 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.
1 +So you're interested in //kicking the maven tyres//, so to speak. It's worth doing some 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/.
2 2  
3 -{{info title="Recommended Homework (or pre-requisites)"}}
3 +But let's assume you want to try it without having to change your current project structure. Maven has what it calls //standards//, such as the [[standard directory layout>>http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html_standard]] but there are numerous options for subverting or extending those standards in order to suit other needs.
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 -
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 mailing list is also very helpful for getting help. See [Getting Help|http://maven.apache.org/users/getting-help.html].
10 -
11 -{{/info}}
12 -
13 -=== Defining the Car - what's the aim ===
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, and of course they each may have something distinctive about them.
16 -
17 -So the car, i.e., the layout of the frameworks and applications, might look like this:
18 -
19 -{{noformat}}
20 -
21 -/
22 -/apps/
23 -/apps/ApplicationA/
24 -/apps/ApplicationB/
25 -/frameworks/
26 -/frameworks/CustomExtensions/
27 -/frameworks/CustomBusinessLogic/
28 -/frameworks/etc/
29 -
30 -{{/noformat}}
31 -
32 -Our aim is to put as much configuration that's shared between all frameworks, for example, into /frameworks/pom.xml as possible so we only have to define it once. The configuration is inherited by a child pom.
33 -
34 -=== Key Concepts ===
35 -
36 -Typical things that make up a pom...
37 -
38 -1. pom parent identification (who do I belong to?)
39 -1. pom identification (who am I?)
40 -1. modules (a.k.a kids; who belongs to me?)
41 -1. dependencies (what do I need?)
42 -1. build sources/resources (what do I have?)
43 -1. properties and filtering resources (variable definitions)
44 -1. dependency/plugin management (shared configuration and versioning)
45 -1. repositories (where to find dependencies and plugins)
46 -
47 -Of course, with the plethora of plugins available for maven, this is only the tip of the iceberg but these main concepts will suffice for now.
48 -
49 -=== Alternate File System Layout Concepts ===
50 -
51 -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.
52 -
53 -{{tip title="Mavan Model Reference Doco"}}
54 -
55 -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].
56 -
57 -{{/tip}}
58 -
59 -The following roughly resembles the current WebObjects WOLips produced project layout (a.k.a Fluffy Bunny layout).
60 -
61 -{{noformat}}
62 -
63 -/MyProject
64 -/MyProject/Components
65 -/MyProject/Resources
66 -/MyProject/Sources
67 -/MyProject/Tests
68 -/MyProject/WebServerResources
69 -
70 -{{/noformat}}
71 -
72 -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)
73 -
74 74  {{code title="pom.xml"}}
75 75  
76 76  <...>
77 77   <build>
78 - <sourceDirectory>Sources</sourceDirectory>
79 - <testSourceDirectory>Tests</testSourceDirectory>
9 + <sourceDirectory>src</sourceDirectory>
10 + <testSourceDirectory>tests</testSourceDirectory>
80 80   <resources>
81 81   <resource>
82 - <targetPath>Resources</targetPath>
83 - <filtering>false</filtering>
84 - <directory>Components</directory>
13 + <resource>
14 + <targetPath>Resources</targetPath>
15 + <filtering>false</filtering>
16 + <directory>Components</directory>
17 + </resource>
18 + <resource>
19 + <targetPath>Resources</targetPath>
20 + <filtering>false</filtering>
21 + <directory>Resources</directory>
22 + </resource>
23 + <resource>
24 + <targetPath>WebServerResources</targetPath>
25 + <filtering>false</filtering>
26 + <directory>WebServerResources</directory>
27 + </resource>
85 85   </resource>
86 - <resource>
87 - <targetPath>Resources</targetPath>
88 - <filtering>false</filtering>
89 - <directory>Resources</directory>
90 - </resource>
91 - <resource>
92 - <targetPath>WebServerResources</targetPath>
93 - <filtering>false</filtering>
94 - <directory>WebServerResources</directory>
95 - </resource>
96 96   </resources>
97 - <...>
98 98   </build>
99 99  <...>
100 100  
101 101  {{/code}}
102 102  
103 -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).
104 -
105 -=== Project Dependencies Concepts ===
106 -
107 -Most projects, of course, have dependencies on other libraries or frameworks.
108 -
109 -=== Project Dependencies Prerequisites ===
110 -
111 -details to come...
112 -
113 -=== Packaging Frameworks as Jars ===
114 -
115 -details to come...
116 -
117 -=== Packaging Applications ===
118 -
119 -details to come...
120 -
121 -=== Project Inheritance ===
122 -
123 -details to come...
124 -
125 -=== Eclipse Integration ===
126 -
127 -details to come...
128 -
129 -=== Putting It All Together ===
130 -
131 -details to come...
35 +more details to come...