Changes for page Maven Kicking the tyres without changing your project structure
Last modified by Henrique Prange on 2015/09/11 17:57
From version 6.1
edited by Lachlan Deck
on 2008/06/23 18:51
on 2008/06/23 18:51
Change comment:
Adding example for frameworks as Jars.
To version 13.1
edited by Lachlan Deck
on 2008/06/15 18:39
on 2008/06/15 18:39
Change comment:
Continuing to flesh it out...
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,7 +2,7 @@ 2 2 3 3 {{info title="Recommended Homework (or pre-requisites)"}} 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/].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 6 7 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 8 ... ... @@ -39,51 +39,33 @@ 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 - 42 + The base triplet used to identify an artifact (i.e., product) 43 + {{noformat}} 46 46 <artifactId>CustomExtensions</artifactId> 47 47 <groupId>com.mywostuff.frameworks</groupId> 48 48 <version>0.0.1-SNAPSHOT</version> 49 - 50 -{{/noformat}} 51 - 47 + {{/noformat}} 52 52 1. pom packaging (i.e., what are we building?) 53 -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) 54 - 55 -{{noformat}} 56 - 49 + 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) 50 + {{noformat}} 57 57 <packaging>woapplication</artifactId> 58 - 59 -{{/noformat}} 60 - 52 + {{/noformat}} 61 61 1. pom parent identification (who do I belong to?) 62 - 63 -{{noformat}} 64 - 54 + {{noformat}} 65 65 <parent> 66 66 <artifactId>frameworks</artifactId> 67 67 <groupId>com.mywostuff</groupId> 68 68 </parent> 69 - 70 -{{/noformat}} 71 - 59 + {{/noformat}} 72 72 1. modules (a.k.a kids; who belongs to me?) 73 - 74 -{{noformat}} 75 - 61 + {{noformat}} 76 76 <modules> 77 77 <module>CustomExtensions</module> 78 78 <module>CustomBusinessLogic</module> 79 79 </modules> 80 - 81 -{{/noformat}} 82 - 66 + {{/noformat}} 83 83 1. dependencies (what do I need?) 84 - 85 -{{noformat}} 86 - 68 + {{noformat}} 87 87 <dependencies> 88 88 <dependency> 89 89 <groupId>log4j</groupId> ... ... @@ -98,15 +98,13 @@ 98 98 <scope>test</scope> 99 99 </dependency> 100 100 </dependencies> 101 - 102 -{{/noformat}} 103 - 83 + {{/noformat}} 104 104 1. build sources/resources (what do I have?) 105 105 1. properties and filtering resources (variable definitions) 106 106 1. dependency/plugin management (shared configuration and versioning) 107 107 1. repositories (where to find dependencies and plugins) 108 108 109 -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. 89 +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. 110 110 111 111 === Alternate File System Layout Concepts === 112 112 ... ... @@ -166,297 +166,20 @@ 166 166 167 167 === Project Dependencies Concepts === 168 168 169 -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]].149 +Most projects, of course, have dependencies on other libraries or frameworks. 170 170 171 - Thefollowing shows the mixtureof third party dependencies and customframework dependencies.Noticethat the scope element determines the life cycle phase each dependencyis relevantfor. See [[Maven Model#class//dependency//>>http://maven.apache.org/ref/2.0.9/maven-model/maven.html#class_dependency]]for specific definitions.151 +=== Project Dependencies Prerequisites === 172 172 173 - {{noformat}}153 +details to come... 174 174 175 - <dependencies> 176 - <dependency> 177 - <artifactId>CustomExtensions</artifactId> 178 - <groupId>com.mywostuff.frameworks</groupId> 179 - <version>0.0.1-SNAPSHOT</version> 180 - <scope>compile</scope> 181 - </dependency> 182 - <dependency> 183 - <groupId>log4j</groupId> 184 - <artifactId>log4j</artifactId> 185 - <version>1.2.12</version> 186 - <scope>compile</scope> 187 - </dependency> 188 - <dependency> 189 - <groupId>junit</groupId> 190 - <artifactId>junit</artifactId> 191 - <version>4.4</version> 192 - <scope>test</scope> 193 - </dependency> 194 - </dependencies> 195 - 196 -{{/noformat}} 197 - 198 -=== Repositories === 199 - 200 -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]].,, 201 - 202 -{{noformat}} 203 - 204 -<repositories> 205 - <repository> 206 - <id>system-repo</id> 207 - <name>internal repository</name> 208 - <!-- TODO switch over to your intranet.domain --> 209 - <url>file://${user.home}/.myarchiva</url> 210 - <snapshots> 211 - <enabled>true</enabled> 212 - <updatePolicy>always</updatePolicy> 213 - <checksumPolicy>ignore</checksumPolicy> 214 - </snapshots> 215 - <releases> 216 - <enabled>true</enabled> 217 - <updatePolicy>always</updatePolicy> 218 - <checksumPolicy>ignore</checksumPolicy> 219 - </releases> 220 - </repository> 221 - <repository> 222 - <id>maven2-repository.dev.java.net</id> 223 - <name>Java.net Repository for Maven</name> 224 - <url>http://download.java.net/maven/2</url> 225 - <snapshots> 226 - <enabled>true</enabled> 227 - <updatePolicy>daily</updatePolicy> 228 - </snapshots> 229 - <releases> 230 - <enabled>true</enabled> 231 - <updatePolicy>daily</updatePolicy> 232 - </releases> 233 - </repository> 234 - <repository> 235 - <id>webobjects.mdimension.com/releases</id> 236 - <name>mdimension maven 2 releases repo</name> 237 - <url>http://webobjects.mdimension.com/maven2/releases</url> 238 - <snapshots> 239 - <enabled>false</enabled> 240 - </snapshots> 241 - <releases> 242 - <enabled>true</enabled> 243 - </releases> 244 - </repository> 245 - <repository> 246 - <id>webobjects.mdimension.com/snapshots</id> 247 - <name>mdimension maven 2 snapshots repo</name> 248 - <url>http://webobjects.mdimension.com/maven2/snapshots</url> 249 - <snapshots> 250 - <enabled>true</enabled> 251 - </snapshots> 252 - <releases> 253 - <enabled>false</enabled> 254 - </releases> 255 - </repository> 256 - <repository> 257 - <id>objectstyle-maven2</id> 258 - <name>objectstyle maven2 repo</name> 259 - <url>http://objectstyle.org/maven2</url> 260 - <snapshots> 261 - <enabled>false</enabled> 262 - </snapshots> 263 - <releases> 264 - <enabled>true</enabled> 265 - </releases> 266 - </repository> 267 -</repositories> 268 - 269 -{{/noformat}} 270 - 271 -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]]. 272 - 273 273 === Packaging Frameworks as Jars === 274 274 275 - Here's thedefinitionfor/frameworks/pom.xml.157 +details to come... 276 276 277 -{{code title="/frameworks/pom.xml"}} 278 - 279 -<?xml version="1.0" encoding="UTF-8"?> 280 -<project xmlns="http://maven.apache.org/POM/4.0.0" 281 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 282 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 283 - http://maven.apache.org/xsd/maven-4.0.0.xsd"> 284 - 285 - <modelVersion>4.0.0</modelVersion> 286 - 287 - <!-- parent artifact --> 288 - <parent> 289 - <artifactId>mywostuff</artifactId> 290 - <groupId>com</groupId> 291 - <version>1.0-SNAPSHOT</version> 292 - </parent> 293 - 294 - <!-- artifact identity --> 295 - <artifactId>frameworks</artifactId> 296 - <groupId>com.mywostuff</groupId> 297 - <packaging>pom</packaging> 298 - 299 - <!-- framework relevant properties --> 300 - <properties> 301 - <!-- NS related properties fills in Info.plist etc--> 302 - <CFBundleDevelopmentRegion>English</CFBundleDevelopmentRegion> 303 - <CFBundleGetInfoString></CFBundleGetInfoString> 304 - <CFBundlePackageType>FMWK</CFBundlePackageType> 305 - <CFBundleIconFile>WOAfile.icns</CFBundleIconFile> 306 - <CFBundleInfoDictionaryVersion>6.0</CFBundleInfoDictionaryVersion> 307 - <CFBundleVersion>5.3.1</CFBundleVersion> 308 - <Has_WOComponents>true</Has_WOComponents> 309 - <NSPrincipalClass>${mainclass}</NSPrincipalClass> 310 - <NSResourcesBundlePath></NSResourcesBundlePath> 311 - </properties> 312 - 313 - <!-- modules --> 314 - <modules> 315 - <module>CustomExtensions</module> 316 - <module>CustomBusinessLogic</module> 317 - </modules> 318 - 319 - <!-- specific dependencies (for modules) --> 320 - <dependencies> 321 - <dependency> 322 - <artifactId>ERExtensions</artifactId> 323 - <groupId>${wonder.common.groupId}</groupId> 324 - </dependency> 325 - <dependency> 326 - <artifactId>JavaWOExtensions</artifactId> 327 - <groupId>${wonder.common.groupId}</groupId> 328 - </dependency> 329 - <dependency> 330 - <artifactId>JavaFoundation</artifactId> 331 - <groupId>${webobjects.groupId}</groupId> 332 - </dependency> 333 - <dependency> 334 - <artifactId>JavaJDBCAdaptor</artifactId> 335 - <groupId>${webobjects.groupId}</groupId> 336 - </dependency> 337 - <dependency> 338 - <artifactId>JavaWebObjects</artifactId> 339 - <groupId>${webobjects.groupId}</groupId> 340 - </dependency> 341 - <dependency> 342 - <artifactId>JavaEOControl</artifactId> 343 - <groupId>${webobjects.groupId}</groupId> 344 - </dependency> 345 - <dependency> 346 - <artifactId>JavaEOAccess</artifactId> 347 - <groupId>${webobjects.groupId}</groupId> 348 - </dependency> 349 - <dependency> 350 - <artifactId>JavaWebObjects</artifactId> 351 - <groupId>${webobjects.groupId}</groupId> 352 - </dependency> 353 - <dependency> 354 - <artifactId>JavaXML</artifactId> 355 - <groupId>${webobjects.groupId}</groupId> 356 - </dependency> 357 - </dependencies> 358 - 359 - 360 - <!-- build config (for modules) --> 361 - <build> 362 - <sourceDirectory>src</sourceDirectory> 363 - <testSourceDirectory>tests</testSourceDirectory> 364 - <resources> 365 - <!-- relative dir for Info.plist --> 366 - <resource> 367 - <targetPath>Resources</targetPath> 368 - <filtering>true</filtering> 369 - <directory>../src/main/resources</directory> 370 - </resource> 371 - <resource> 372 - <targetPath>Resources</targetPath> 373 - <filtering>false</filtering> 374 - <directory>Components</directory> 375 - </resource> 376 - <resource> 377 - <targetPath>Resources</targetPath> 378 - <filtering>false</filtering> 379 - <directory>Resources</directory> 380 - </resource> 381 - <resource> 382 - <targetPath>WebServerResources</targetPath> 383 - <filtering>false</filtering> 384 - <directory>WebServerResources</directory> 385 - </resource> 386 - </resources> 387 - <plugins> 388 - <plugin> 389 - <groupId>org.apache.maven.plugins</groupId> 390 - <artifactId>maven-compiler-plugin</artifactId> 391 - <configuration> 392 - <source>${java.target}</source> 393 - <target>${java.target}</target> 394 - </configuration> 395 - </plugin> 396 - </plugins> 397 - </build> 398 -</project> 399 - 400 -{{/code}} 401 - 402 -and CustomExtensions which has no further dependencies 403 - 404 -{{code title="/frameworks/CustomBusinessLogic/pom.xml"}} 405 - 406 -<?xml version="1.0"?> 407 -<project> 408 - <!-- parent artifact --> 409 - <parent> 410 - <artifactId>frameworks</artifactId> 411 - <groupId>com.mywostuff</groupId> 412 - <version>1.0-SNAPSHOT</version> 413 - </parent> 414 - 415 - <!-- artifact identity --> 416 - <artifactId>CustomBusinessLogic</artifactId> 417 - <groupId>com.mywostuff.frameworks</groupId> 418 -</project> 419 - 420 -{{/code}} 421 - 422 -and CustomBusinessLogic (which has a further dependency on CustomExtensions) 423 - 424 -{{code title="/frameworks/CustomBusinessLogic/pom.xml"}} 425 - 426 -<?xml version="1.0"?> 427 -<project> 428 - <!-- parent artifact --> 429 - <parent> 430 - <artifactId>frameworks</artifactId> 431 - <groupId>com.mywostuff</groupId> 432 - <version>1.0-SNAPSHOT</version> 433 - </parent> 434 - 435 - <!-- artifact identity --> 436 - <artifactId>CustomBusinessLogic</artifactId> 437 - <groupId>com.mywostuff.frameworks</groupId> 438 - 439 - <!-- specific dependencies --> 440 - <dependencies> 441 - <dependency> 442 - <artifactId>CustomExtensions</artifactId> 443 - <groupId>${pom.groupId}</groupId> 444 - </dependency> 445 - </dependencies> 446 -</project> 447 - 448 -{{/code}} 449 - 450 450 === Packaging Applications === 451 451 452 452 details to come... 453 453 454 -=== Packaging Applications as True WAR === 455 - 456 -You can find steps to package WO Applications as True WAR [[here>>Packaging WO Applications as true WAR with Maven]]. 457 - 458 -more details to come... 459 - 460 460 === Project Inheritance === 461 461 462 462 details to come...