You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Pablo <pa...@tiger.com.pl> on 2006/01/10 16:38:35 UTC
how to use maven-compiler-plugin
Hello everyone (this mail was sent to users@maven.apache.org but I
didn't get clear answer)
I have the following project structure:
/src/webapp/WEB-INF/src etc.
/src/tests
/src/integration-tests
Junit tests are compiled automatically by setting the value below:
<testSourceDirectory>src/tests/java</testSourceDirectory>
Now I want to use the same plugin to compile integration-tests. The
compiled tests should be placed in target/integration-tests.
Since fields:
private List compileSourceRoots;
private File outputDirectory;
are readonly it's not possible to set them in plugin's configuration.
I removed @readonly attribute and installed the plugin just to see if it
would work.
This is the part of my pom.xml which defines compiler plugin:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>iso-8859-2</encoding>
</configuration>
<executions>
<execution>
<id>testy</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<compileSourceRoots>
<compileSourceRoot>src/integration-tests</compileSourceRoot>
</compileSourceRoots>
<outputDirectory>${project.build}/integration-tests</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
I thought that I could change compilesourceRoot and outputDirectory and
all integration tests would be compiled.
But it isn't so:
pablo@pablopc:~/cvsroot/webapp$ mvn clean test-compile
[INFO] Scanning for projects...
[INFO]
----------------------------------------------------------------------------
[INFO] Building WebApp
[INFO] task-segment: [clean, test-compile]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /home/pablo/cvsroot/webapp/target
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 225 source files to /home/pablo/cvsroot/webapp/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
Compiling 19 source files to /home/pablo/cvsroot/webapp/target/test-classes
[INFO] [compiler:testCompile {execution: testy}]
Compiling 19 source files to
/home/pablo/cvsroot/webapp/target/integration-tests
[INFO]
----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
----------------------------------------------------------------------------
[INFO] Total time: 59 seconds
[INFO] Finished at: Tue Jan 10 13:50:51 CET 2006
[INFO] Final Memory: 7M/33M
[INFO]
----------------------------------------------------------------------------
The compiler plugin is run twice. As you can see
<outputDirectory>${project.build}/integration-tests</outputDirectory>
is used but test sources' directory is not. What am I doing wrong? How
can I use this plugin to compile additional things? And will it be ever
possible to do it? To make it work partially I had to remove @readonly
attributes.
Thanks for reading
Pablo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: how to use maven-compiler-plugin
Posted by Brett Porter <br...@apache.org>.
Pablo wrote:
> Hello everyone (this mail was sent to users@maven.apache.org but I
> didn't get clear answer)
It was the right place - you won't get any other answer here.
If you still need help, please follow up the thread on users@
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org