Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of ${project.basedir} in pom.xml

What is the meaning of

<directory>${project.basedir}</directory> 

and

${project.build.directory} 

in pom.xml

like image 817
TodayILearned Avatar asked Mar 14 '16 10:03

TodayILearned


People also ask

What is project tag in POM XML?

It is the sub element of project. It specifies the version of the artifact under given group. File: pom.xml. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

What is project build outputDirectory in Maven?

sourceDirectory , scriptSourceDirectory , and testSourceDirectory provide access to the source directories for the project. outputDirectory and testOutputDirectory provide access to the directories where Maven is going to put bytecode or other build output.

What is base directory in Maven?

It's a directory where the pom. xml is stored (in the root of the project).


2 Answers

There are a set of available properties to all Maven projects.

From Introduction to the POM:

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.xml file. If your POM is located inside /path/to/project/pom.xml then this property will evaluate to /path/to/project.

Some properties are also inherited from the Super POM, which is the case for project.build.directory. It is the value inside the <project><build><directory> element of the POM. You can get a description of all those values by looking at the Maven model. For project.build.directory, it is:

The directory where all files generated by the build are placed. The default value is target.

This is the directory that will hold every generated file by the build.

like image 118
Tunaki Avatar answered Sep 22 '22 20:09

Tunaki


${project.basedir} is the root directory of your project.

${project.build.directory} is equivalent to ${project.basedir}/target

as it is defined here: https://github.com/apache/maven/blob/trunk/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml#L53

like image 37
Matthias Avatar answered Sep 23 '22 20:09

Matthias