Maven: specify the outputDirectory only for packaging a jar

mavenmaven-2

How can I specify the outputDirectory only for packaging a jar?

http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html this shows all parameters, but how can I set them in the commandline or pom.xml?

Best Answer

on command line

-DoutputDirectory=<path>

and in pom.xml

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
        <outputDirectory>/my/path</outputDirectory>
      </configuration>
    </plugin>
  </plugins>
</build>