user1285928
user1285928

Reputation: 1476

How to change maven build directory?

I have a maven project which I compile with Netbeans. I there a way to specify a different build directory where the compiled binary code is copied after compilation?

Upvotes: 29

Views: 64747

Answers (2)

Reimeus
Reimeus

Reputation: 159754

Sure. Update your POM with:

<build>
  <directory>my_new_build_path</directory>
</build>

Part 2: To specify the output path for a WAR:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <warName>test-web-app</warName>
        <outputDirectory>my_output_path</outputDirectory>
    </configuration>
</plugin>

Upvotes: 25

Michał Kalinowski
Michał Kalinowski

Reputation: 17923

<project>
  <build>
    <outputDirectory>target/classes</outputDirectory>
  </build>
</project>

Upvotes: 19

Related Questions