Changes for page Packaging WO Applications as true WAR with Maven
Last modified by Ulrich Köster on 2009/08/02 20:26
From version 24.1
edited by Henrique Prange
on 2009/08/02 20:26
on 2009/08/02 20:26
Change comment:
Migrated to Confluence 4.0
To version 20.1
edited by Greg.Brown
on 2009/08/02 18:21
on 2009/08/02 18:21
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. hprange1 +XWiki.gbrown - Content
-
... ... @@ -1,10 +1,10 @@ 1 -If you have used the [[ doc:woapplication-archetype]] to create your project, jump to the step 3.1 +If you have used the [[woapplication-archetype]] to create your project, jump to the step 3. 2 2 3 3 You have to follow some instructions to build a true WAR package: 4 4 5 5 == Step 1: Create a web.xml file == 6 6 7 -You need to create a web.xml file. You can download a simple web.xml file [[here>> attach:web.xml]]. Don't forget to change the displayName and the WOMainBundle properties:7 +You need to create a web.xml file. You can download a simple web.xml file [[here>>^web.xml]]. Don't forget to change the displayName and the WOMainBundle properties: 8 8 9 9 {{noformat}} 10 10 ... ... @@ -23,7 +23,7 @@ 23 23 24 24 == Step 2: Create/generate an Info.plist file == 25 25 26 -You also need to create or generate a valid Info.plist file into your resources folder. [[Here>> attach:Info.plist]] is a sample Info.plist. You have to change the ${your-app-name}and ${package}occurrences with the respective application name and Application class package.26 +You also need to create or generate a valid Info.plist file into your resources folder. [[Here>>^Info.plist]] is a sample Info.plist. You have to change the $your-app-name and $package occurrences with the respective application name and Application class package. 27 27 28 28 == Step 3: Package your classes, resources and webserver resources == 29 29 ... ... @@ -32,24 +32,7 @@ 32 32 {{noformat}} 33 33 34 34 <build> 35 - ... 36 - <resources> 37 37 ... 38 - <resource> 39 - <targetPath>Resources</targetPath> 40 - <directory>${basedir}/src/main/resources</directory> 41 - </resource> 42 - <resource> 43 - <targetPath>Resources</targetPath> 44 - <directory>${basedir}/src/main/components</directory> 45 - </resource 46 - <resource> 47 - <targetPath>WebServerResources</targetPath> 48 - <directory>${basedir}/src/main/webserver-resources</directory> 49 - </resource> 50 - ... 51 - </resources> 52 - ... 53 53 <plugins> 54 54 ... 55 55 <plugin> ... ... @@ -91,23 +91,11 @@ 91 91 92 92 {{/noformat}} 93 93 94 -**NOTE**: If your application uses Wonderyou mustaddtheERXServletdependency:77 +**NOTE**: if your application uses Wonder, please read [[this tutorial>>http://wiki.objectstyle.org/confluence/display/WONDER/Creating+a+wonder+app+to+deploy+as+a+servlet]]. 95 95 96 -{{noformat}} 97 - 98 -<dependency> 99 - <groupId>wonder.core</groupId> 100 - <artifactId>ERServlet</artifactId> 101 - <version>1.0</version> 102 -</dependency> 103 - 104 -{{/noformat}} 105 - 106 -Read this [[tutorial>>url:http://wiki.objectstyle.org/confluence/display/WONDER/Creating+a+wonder+app+to+deploy+as+a+servlet||shape="rect"]] to find how to configure the ERXServletAdaptor in your application. 107 - 108 108 == Step 5: Change the packaging type == 109 109 110 -The default [[maven-war-plugin>> url:http://maven.apache.org/plugins/maven-war-plugin/||shape="rect"]] can handle the war packaging correctly. You have to change the packaging of your POM to 'war' in order to use this plug-in:81 +The default [[maven-war-plugin>>http://maven.apache.org/plugins/maven-war-plugin/]] can handle the war packaging correctly. You have to change the packaging of your POM to 'war' in order to use this plug-in: 111 111 112 112 {{noformat}} 113 113 ... ... @@ -117,55 +117,49 @@ 117 117 118 118 It's done. 119 119 120 -== Step 6: Filtering variables with Maven (OPTIONAL) == 91 +{{panel title="2009 Bug Warning" borderStyle="dashed" borderColor="#ccc" titleBGColor="#F7D6C1" bgColor="#FFFFCE"}} 92 + 93 +It should be done, but... 94 +The 2.0.17 archetype does not add : 95 +{noformat} 96 + <resource> 97 + <targetPath>Resources</targetPath> 98 + <directory>${basedir}/src/main/components</directory> 99 + </resource> 100 + <resource> 101 + <targetPath>WebServerResources</targetPath> 102 + <directory>${basedir}/src/main/webserver-resources</directory> 103 + </resource> 104 +{noformat} 105 +to the pom.xml file, so your war will have no components; you should add these lines. 121 121 122 -Maven supports variable substitution during build time. It is called resource filtering. You can find more information about resource filtering [[here>>url:http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html||shape="rect"]] and [[here>>url:http://www.sonatype.com/books/maven-book/reference/resource-filtering-sect-description.html||shape="rect"]]. 107 +Also, it does not add a necessary WebObjects 5.3 dependency and, if using Wonder, the ERServlet.jar: 108 +{noformat} 109 + <dependency> 110 + <groupId>${webobjects.groupId}</groupId> 111 + <artifactId>JavaWOJSPServlet_client 112 + </artifactId> 113 + <version>${webobjects.version}</version> 114 + </dependency> 115 + <dependency> 116 + <groupId>wonder.core</groupId> 117 + <artifactId>ERServlet</artifactId> 118 + <version>1.0</version> 119 + </dependency> 120 +{noformat} 121 +So, you may need to add that. 123 123 124 -I fyouareusingvariables inyour resourcefiles(i.e.theInfo.plist),youhavetoconfigureMaventofiltertheResourcesfolderlike this:123 +In addition, the archetype generated Info.plist needs fixing, as does the web.xml in the WEB-INF folder. There are values in these files like $\{project.artifactId\}, but for now, you must manually replace those values with actual values, e.g, MyProject. 125 125 126 -{{noformat}} 125 +These probably will be fixed in the next release of plugins, but for now, watch this space, as there may be additional 126 +bugs posted here. 127 + 127 127 128 -<build> 129 - ... 130 - <resources> 131 - ... 132 - <resource> 133 - <targetPath>Resources</targetPath> 134 - <directory>${basedir}/src/main/resources</directory> 135 - <filtering>true</filtering> 136 - </resource> 137 - ... 138 - </resources> 139 - ... 140 -</build> 129 +{{/panel}} 141 141 142 -{{/noformat}} 143 - 144 -If you are using variables in the web.xml file, you have to configure Maven to filter deployment descriptors like this: 145 - 146 -{{noformat}} 147 - 148 -<build> 149 - ... 150 - <plugins> 151 - ... 152 - <plugin> 153 - <artifactId>maven-war-plugin</artifactId> 154 - <configuration> 155 - ... 156 - <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors> 157 - </configuration> 158 - </plugin> 159 - ... 160 - </plugins> 161 - ... 162 -</build> 163 - 164 -{{/noformat}} 165 - 166 166 = Running your application as true WAR = 167 167 168 -You can use the [[maven-jetty-plugin>> url:http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin||shape="rect"]] to run and test your application.133 +You can use the [[maven-jetty-plugin>>http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin]] to run and test your application. 169 169 170 170 == Step 1: Configure the maven-jetty-plugin == 171 171 ... ... @@ -196,4 +196,4 @@ 196 196 197 197 == Step 3: See the result == 198 198 199 -Open a browser and type the URL for your application like this: [[http: ~~/~~/locahost:8080/your-app-name/WebObjects/>>url:http://locahost:8080/your-app-name/WebObjects/||shape="rect"]]164 +Open a browser and type the URL for your application like this: [[http://locahost:8080/your-app-name/WebObjects/]]