Last modified by Yana Oksner on 2026/01/08 12:23

From version 31.2
edited by Henrique Prange
on 2023/11/13 11:58
Change comment: Update document after refactoring.
To version 32.1
edited by Yana Oksner
on 2026/01/08 12:23
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.hprange
1 +XWiki.yanasd
Content
... ... @@ -30,7 +30,7 @@
30 30  
31 31  The layout of the frameworks and applications might look like this:
32 32  
33 -{{noformat}}
33 +{{code}}
34 34  /trunk/
35 35  /trunk/apps/
36 36  /trunk/apps/ApplicationA/
... ... @@ -40,7 +40,7 @@
40 40  /trunk/frameworks/CustomBusinessLogic/
41 41  /trunk/frameworks/etc/
42 42  
43 -{{/noformat}}
43 +{{/code}}
44 44  
45 45  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:
46 46  
... ... @@ -55,48 +55,48 @@
55 55  pom identification (who am I?)
56 56   The base triplet used to identify an artifact (i.e., something you need to build/package/install)
57 57  
58 -{{noformat}}
58 +{{code}}
59 59   <artifactId>CustomExtensions</artifactId>
60 60   <groupId>com.mywostuff.frameworks</groupId>
61 61   <version>0.0.1-SNAPSHOT</version>
62 62  
63 -{{/noformat}}
63 +{{/code}}
64 64  )))
65 65  1. (((
66 66  pom packaging (i.e., what are we building?)
67 67   The default value for the packaging element is JAR if not specified. For the purposes of this exercise, we'll use JAR for the frameworks and woapplication for the applications, which requires the woproject maven plugin (TODO revisit this scenario with the apple maven plugin)
68 68  
69 -{{noformat}}
69 +{{code}}
70 70   <packaging>woapplication</packaging>
71 71  
72 -{{/noformat}}
72 +{{/code}}
73 73  )))
74 74  1. (((
75 75  pom parent identification (who do I belong to?)
76 76  
77 -{{noformat}}
77 +{{code}}
78 78   <parent>
79 79   <artifactId>frameworks</artifactId>
80 80   <groupId>com.mywostuff</groupId>
81 81   </parent>
82 82  
83 -{{/noformat}}
83 +{{/code}}
84 84  )))
85 85  1. (((
86 86  modules (a.k.a kids; who belongs to me?)
87 87  
88 -{{noformat}}
88 +{{code}}
89 89   <modules>
90 90   <module>CustomExtensions</module>
91 91   <module>CustomBusinessLogic</module>
92 92   </modules>
93 93  
94 -{{/noformat}}
94 +{{/code}}
95 95  )))
96 96  1. (((
97 97  dependencies (what do I need?)
98 98  
99 -{{noformat}}
99 +{{code}}
100 100   <dependencies>
101 101   <dependency>
102 102   <groupId>log4j</groupId>
... ... @@ -112,7 +112,7 @@
112 112   </dependency>
113 113   </dependencies>
114 114  
115 -{{/noformat}}
115 +{{/code}}
116 116  )))
117 117  1. build sources/resources (what do I have?)
118 118  1. properties and filtering resources (variable definitions)
... ... @@ -131,7 +131,7 @@
131 131  
132 132  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).
133 133  
134 -{{noformat}}
134 +{{code}}
135 135  /MyProject
136 136  /MyProject/Components
137 137  /MyProject/Resources
... ... @@ -139,7 +139,7 @@
139 139  /MyProject/Tests
140 140  /MyProject/WebServerResources
141 141  
142 -{{/noformat}}
142 +{{/code}}
143 143  
144 144  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)
145 145  
... ... @@ -179,7 +179,7 @@
179 179  
180 180  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.
181 181  
182 -{{noformat}}
182 +{{code}}
183 183   <dependencies>
184 184   <dependency>
185 185   <artifactId>CustomExtensions</artifactId>
... ... @@ -201,7 +201,7 @@
201 201   </dependency>
202 202   </dependencies>
203 203  
204 -{{/noformat}}
204 +{{/code}}
205 205  
206 206  === Project Inheritance ===
207 207  
... ... @@ -213,7 +213,7 @@
213 213  
214 214  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.
215 215  
216 -{{noformat}}
216 +{{code}}
217 217  <repositories>
218 218   <repository>
219 219   <id>system-repo</id>
... ... @@ -279,7 +279,7 @@
279 279   </repository>
280 280  </repositories>
281 281  
282 -{{/noformat}}
282 +{{/code}}
283 283  
284 284  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"]].
285 285