11/09/2007

Maven 2: useful command lines

Web application
Create a Blank web app (war)
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.abb.example -DartifactId=example

Struts 1
Create a Struts Blank web app (war)
mvn archetype:create -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts-archetype-blank -DarchetypeVersion=1.3.5 -DgroupId=com.abb.example -DpackageName=com.abb.example.test -DartifactId=app-test (error: deprecated goal with this version)

Struts 2
Create a Struts 2 tutorial web app (war)
mvn archetype:create -DgroupId=tutorial -DartifactId=tutorial -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-starter -DarchetypeVersion=2.0.9-SNAPSHOT -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository

WTP
Set the project as a web app in WTP (Eclipse Web Tool)
mvn clean eclipse:clean eclipse:eclipse -Dwtpversion=1.5
Add in pom.xml:
  maven-eclipse-plugin, configuration wtpversion = 1.5
and maybe:
  maven-compiler-plugin, 1.5 (in build plugins)


New projet
Create a java project (jar)
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

...

01/09/2007

Tomcat jar locking

Tomcat locks some jar files

Symptom
In Tomcat server, when I undeploy my web application, there are still some jar files locked by the server.

Solution
Use the following parameters: antiJARLocking and antiResourceLocking in the context configuration.
Example:
<!-- The contents of this file will be loaded for each web application -->
<Context antiJarLocking="true" antiResourceLocking="true">

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>

</Context>


Link
Tomcat configuration context