Wiki source code of Maven Creating Wonder Applications
Version 25.1 by Lachlan Deck on 2009/02/20 11:22
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | = Creating Wonder Applications using Maven + m2eclicpse = | ||
| 2 | |||
| 3 | {{note}} | ||
| 4 | Under Construction | ||
| 5 | {{/note}} | ||
| 6 | |||
| 7 | If you want to use Wonder in your applications (and why woundn't one) you must be correctly setup with: | ||
| 8 | |||
| 9 | * eclipse + wolips > see tutorial about installation and operation. | ||
| 10 | * Maven > see the Maven [[Quick Start]] tutorial. | ||
| 11 | * plugins like [[m2eclipse>>http://m2eclipse.codehaus.org/]] which supports Maven-eclipse integration. | ||
| 12 | * Wonder sources which then are built and installed in your local repository. | ||
| 13 | |||
| 14 | One reasonable way to get and maintain the Wonder sources is have a directory which holds all the sources (see here: [[Download Wonder Source>>http://wiki.objectstyle.org/confluence/display/WONDER/Download+Wonder+Source%2C+Build+and+Install]]), then use Maven to install and build Wonder (see here: [[Building the wonder source code with maven]]). | ||
| 15 | |||
| 16 | Several things you should know, currently: | ||
| 17 | |||
| 18 | * Wonder is built using a maven "build profile", e.g. "mvn clean install --P wo53" builds things for a WebObjects 5.3.x environment and "mvn clean install --P wo54" builds things for a WebObjects 5.4.x environment. | ||
| 19 | * The only frameworks which are different because of this are ERExtensions and WOOgnl. | ||
| 20 | * Because of this difference you must specify which version you want. For instance, you may want the ERExtensions-5.0.0-SNAPSHOT-wo53.jar, or the ERExtensions-5.0.0-SNAPSHOT-wo54.jar. You specify by adding a "classifier", which would have the value of wo53 or wo54. The other frameworks should not have this classifier. | ||
| 21 | |||
| 22 | With all the tools ready, it's time to make a Wonder application. | ||
| 23 | |||
| 24 | ~1. Make a new project File > New > Other project, choose a Maven project: [[image:wolimmave2.gif]] | ||
| 25 | |||
| 26 | 2. Hit Next | ||
| 27 | |||
| 28 | 3. Hit Next again [[image:wolimmavena.gif]] | ||
| 29 | |||
| 30 | 4. Select an archtype, use the local catalog, select the woapplication-archtype, hit Next:!wolimmavenb.gif! | ||
| 31 | |||
| 32 | 5. Fill in appropriate parameters for the woapplication-archtype to set up your new application, hit Finish! | ||
| 33 | |||
| 34 | [[image:wolimmaven.gif]] | ||
| 35 | |||
| 36 | The eclipse plugins now create your application! | ||
| 37 | |||
| 38 | You should create a WOApplication Run Configuration and add the projects build folder's Java to the classpath as detailed here: [[Maven Running or Debugging as WO Application]], otherwise classes won't be found, etc. | ||
| 39 | |||
| 40 | {{note title="Warning"}} | ||
| 41 | The woapplication-archtype is under construction, so you must fix a few things. | ||
| 42 | # Fix the pom.xml. Delete the properties and dependencies sections that the woapplication-archtype created, and paste this into the pom: | ||
| 43 | {code:xml} | ||
| 44 | |||
| 45 | <properties> | ||
| 46 | <woclassifier>wo54</woclassifier> | ||
| 47 | <woversion>5.4.3</woversion> | ||
| 48 | <wonderversion>5.0.0-SNAPSHOT</wonderversion> | ||
| 49 | </properties> | ||
| 50 | |||
| 51 | <!-- the dependency management section defines the characteristics of your dependencies to use when referenced elsewhere --> | ||
| 52 | <!-- See http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html --> | ||
| 53 | <dependencyManagement> | ||
| 54 | <!-- Only ERExtensions and WOOgnl need a wo53 or wo54 classifier but adding it for all WOnder dependencies safeguards it for any future changes to WOnder --> | ||
| 55 | <dependencies> | ||
| 56 | <!-- in the order you'd like --> | ||
| 57 | <dependency> | ||
| 58 | <groupId>wonder.core</groupId> | ||
| 59 | <artifactId>ERExtensions</artifactId> | ||
| 60 | <version>${wonderversion}</version> | ||
| 61 | <classifier>${woclassifier}</classifier> | ||
| 62 | </dependency> | ||
| 63 | <dependency> | ||
| 64 | <groupId>wonder.core</groupId> | ||
| 65 | <artifactId>ERPrototypes</artifactId> | ||
| 66 | <version>${wonderversion}</version> | ||
| 67 | <classifier>${woclassifier}</classifier> | ||
| 68 | </dependency> | ||
| 69 | <dependency> | ||
| 70 | <groupId>wonder.core</groupId> | ||
| 71 | <artifactId>WOOgnl</artifactId> | ||
| 72 | <version>${wonderversion}</version> | ||
| 73 | <classifier>${woclassifier}</classifier> | ||
| 74 | </dependency> | ||
| 75 | <dependency> | ||
| 76 | <groupId>com.webobjects</groupId> | ||
| 77 | <artifactId>JavaWebObjects</artifactId> | ||
| 78 | <version>${woversion}</version> | ||
| 79 | </dependency> | ||
| 80 | <dependency> | ||
| 81 | <groupId>com.webobjects</groupId> | ||
| 82 | <artifactId>JavaEOAccess</artifactId> | ||
| 83 | <version>${woversion}</version> | ||
| 84 | </dependency> | ||
| 85 | <dependency> | ||
| 86 | <groupId>com.webobjects</groupId> | ||
| 87 | <artifactId>JavaFoundation</artifactId> | ||
| 88 | <version>${woversion}</version> | ||
| 89 | </dependency> | ||
| 90 | </dependencies> | ||
| 91 | </dependencyManagement> | ||
| 92 | |||
| 93 | <!-- now you just reference the groupId and artifactId of each dependency required. This will work for any child pom also. --> | ||
| 94 | <!-- See http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html --> | ||
| 95 | <dependencies> | ||
| 96 | <dependency> | ||
| 97 | <groupId>wonder.core</groupId> | ||
| 98 | <artifactId>ERExtensions</artifactId> | ||
| 99 | <classifier>${wonderclassifier}</classifier> | ||
| 100 | </dependency> | ||
| 101 | <dependency> | ||
| 102 | <groupId>wonder.core</groupId> | ||
| 103 | <artifactId>WOOgnl</artifactId> | ||
| 104 | <classifier>${wonderclassifier}</classifier> | ||
| 105 | </dependency> | ||
| 106 | <dependency> | ||
| 107 | <groupId>wonder.core</groupId> | ||
| 108 | <artifactId>ERPrototypes</artifactId> | ||
| 109 | </dependency> | ||
| 110 | <dependency> | ||
| 111 | <groupId>com.webobjects</groupId> | ||
| 112 | <artifactId>JavaFoundation</artifactId> | ||
| 113 | </dependency> | ||
| 114 | <dependency> | ||
| 115 | <groupId>com.webobjects</groupId> | ||
| 116 | <artifactId>JavaWebObjects</artifactId> | ||
| 117 | </dependency> | ||
| 118 | <dependency> | ||
| 119 | <groupId>com.webobjects</groupId> | ||
| 120 | <artifactId>JavaEOAccess</artifactId> | ||
| 121 | </dependency> | ||
| 122 | </dependencies> | ||
| 123 | |||
| 124 | {code} Fix the versions and classifiers in the pom to be the correct values. | ||
| 125 | |||
| 126 | 2. Fix the Application, Session, DirectAction jave files import statements. As of this writing the import statements are incorrect for Wonder 5.0 which refactored all its classes into packages other than {code}er.extensions{code}. So just right click on These three files and choose Source > Organize Imports which should, as of this writing, make them {code}import er.extensions.appserver.ERX...{code} | ||
| 127 | |||
| 128 | 3. Possibly change web components to extend er.extensions.components.ERXComponent instead of the standard WOComponent. | ||
| 129 | 4. Possible classpath issues; the eclipse component editor has multiple Component and Display Group tabs.? | ||
| 130 | 5. Main component is NSMacOSRomanStringEncoding, non-Maven Wonder apps use "UTF-8" in the woo. | ||
| 131 | |||
| 132 | {{/note}} |