The functionality your plugin provides was exactly what we were looking for.
Except for one little glitch we experienced where the
targetDirectory-directive would be added to the
source-jar.
Because we provide a slightly unusual targetDirectory-directive(to automate
the inclusion of optimized javascript files), the source packaging
process(subprocess of maven-source-plugin)
eventually ends up in a packaging loop, provoked by the source file
being opened for writing to AND reading from (first reading from, then
writing to).
I've attached a patch solving the problem by omitting the inclusion of the
targetDirectory if you set addResource to false.
This is our current maven configuration (pom.xml)
<plugin>
<groupId>org.apache.myfaces.trinidadbuild</groupId>
<artifactId>maven-javascript-plugin</artifactId>
<configuration>
<sourcePath>./javascript</sourcePath>
<sourceDirectory>src/main/webapp/resources</sourceDirectory>
<targetPath>./debug/javascript</targetPath>
<targetDirectory>${project.build.directory}</targetDirectory>
<optimizeTargetPath>./${project.artifactId}-${project.parent.version}/resources/javascript</optimizeTargetPath>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>reduce-javascript</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceExclude>*javascript/*.js</warSourceExclude>
</configuration>
</plugin>
-Michael
--- ReduceJavascriptMojo.java 2010-07-14 17:33:43.000000000 +0200
+++ ReduceJavascriptMojo.java 2010-07-14 17:40:01.000000000 +0200
@@ -55,7 +55,10 @@
{
Resource resource = new Resource();
resource.setDirectory(targetDirectory.getCanonicalPath());
- project.addResource(resource);
+ if (this.addResource)
+ {
+ project.addResource(resource);
+ }
// TODO: switch Optimized, not Debug, to be the special-case
// so that Debug can be processed as ordinary resource copy
@@ -161,6 +164,11 @@
* @parameter
*/
private String optimizeTargetPath;
+
+ /**
+ * @parameter
+ */
+ private boolean addResource;
}