Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the default value of ${project.build.outputDirectory} in Maven?

Tags:

maven

I would like to know how to change the default value of ${project.build.outputDirectory} from target/classes to codebase in maven.

Thanks

like image 969
galme Avatar asked Jul 16 '13 10:07

galme


People also ask

How is project Basedir defined in POM xml?

project. basedir : The directory that the current project resides in. This means this points to where your Maven projects resides on your system. It corresponds to the location of the pom.

What is the project build directory?

The build directory contains the project build files, including images, packages, kernel, and other files that comprise your build.

What is target directory in Maven?

The target directory is used to house all output of the build. The src directory contains all of the source material for building the project, its site and so on. It contains a subdirectory for each type: main for the main build artifact, test for the unit test code and resources, site and so on.

Which option rightly gives the project's source directory in Maven?

Source Directories The Maven property ${project. basedir} defaults to the top level directory of the project, so the build directory defaults to the target directory in project base dir. It also sets the property ${project.


1 Answers

inside the pom.xml within build:

<build>
  <directory>${project.basedir}/target</directory>
  <outputDirectory>${project.build.directory}/classes</outputDirectory>
</build>

see http://maven.apache.org/pom.html for even more fun with the pom

like image 90
wemu Avatar answered Sep 28 '22 09:09

wemu