maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Rohlfs <pomar...@googlemail.com>
Subject Re: War plugin (2.1-beta-1,*] problem
Date Tue, 15 Feb 2011 15:27:08 GMT
Hi Cem!


 > But another question, why didnt my configuration work?

For <packaging>pom</packaging>, the 'war:war' goal is already bound to 
the package phase (with the execution ID 'default-war'). With 'test2', 
You added an additional execution with its own configuration.

Please take a look at the build output. You'll see 2 'war:war' executions:
1. The first one is the 'default-war' execution. It works with 
'useCache=false' and overwrites the 'new-token' text file with 
'old-token' file.
2. The second one is the 'test2' execution. It works with 
'useCache=true', but the text file has already been reset by the 
'default-war' execution.

Try to rename 'test2' to 'default-war' and You'll see that it works like 
You assumed: now there's only one 'war:war' execution left, and it works 
with 'useCache=true'. Maybe I'm wrong, but I'd suggest not to be too 
confident that the default execution ID will always be 'default-war'.

What I did is just globally setting 'useCache=true' for all executions 
(including Your custom war:exploded).


One last point: I'd suggest not to modify the resources in the same 
directory where the maven-war-plugin assembles them. This might 
sometimes lead to unwanted effects, e.g. when You want to do a simple 
build without executing the 'clean' life cycle. What about this:
1.a) Copy the resources to be modified to another (custom) subfolder of 
the target directory (e.g. using the resources:copy-resources goal; see 
http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html) 
and use Your plugin to modify the resources in there.
1.b) Configure Your custom plugin (or the maven-replacer-plugin) with 
input directory 'src/main/webapp' and set its output directory to a 
(custom) subfolder of the target directory.
2. Use the 'webResources' parameter of the maven-war-plugin to add the 
modified resources to Your webapp (see 
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html).


Kind regards

    Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message