By default the maven compiler plugin put the compiled classes into ${project.build.directory}/classes
. I want to put them into ${project.build.directory}/myclasses
. The argument -d
changes the destination of the compiled classes. I configured the plugin but I got an error: javac: directory not found: C:\home\target/myclasses
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<showDeprecation>true</showDeprecation>
<compilerArguments>
<d>${project.build.directory}/myclasses</d>
</compilerArguments>
</configuration>
</plugin>
You should be able to do it like this:
<build>
<outputDirectory>${project.build.directory}/myclasses</outputDirectory>
</build>
The destination folder must exists. You can create it using a ant task:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>createClassesDir</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/myclasses" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With