You must use profiles.
<profiles> <profile> <id>otherOutputDir</id> <build> <directory>yourDirectory</directory> </build> </profile> </profiles>
And run maven with your profile
mvn compile -PotherOutputDir
If you really want to define your directory from the command line, you can do something like this ( NOT recommended at all ):
<properties> <buildDirectory>${project.basedir}/target</buildDirectory> </properties> <build> <directory>${buildDirectory}</directory> </build>
And compile like this:
mvn compile -DbuildDirectory=test
This is because you cannot change the destination directory using -Dproject.build.directory
Colin Hebert Oct 11 '10 at 16:23 2010-10-11 16:23
source share