Hi,
I found what may be a bug in the way the Ant Java task is executed
under the Maven AntRun plugin. The bug is that the output attribute of
the Java task is ignored unless the vm is forked. Consider the
following reduced example:
pom.xml:
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>test</id>
<phase>initialize</phase>
<configuration>
<tasks>
<java classname="Hello" output="test.out">
<classpath>
<path path="${basedir}"/>
</classpath>
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Hello.java:
public class Hello {
public static void main(String[] args){
System.out.println("Hello!");
}
}
This will print "Hello!" to the command line. It will also create the
file test.out, if it does not exist, but the file will be empty.
On the other hand, when the vm is forked, as in the following pom.xml,
Maven will not print "Hello!" to the command line, but will instead
write it to the file test.out, as expected
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>test</id>
<phase>initialize</phase>
<configuration>
<tasks>
<java classname="Hello" output="test.out" fork="true">
<classpath>
<path path="${basedir}"/>
</classpath>
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Is this worth filing a bug report over?
Please let me know. Thanks,
Jake
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]