Showing posts with label effective pom. Show all posts
Showing posts with label effective pom. Show all posts

Monday, 8 July 2019

Maven: project.build.directory


This is continuation to my previous post, Super POM.

As you see the super pom file, you can see many variables like below.
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>${project.basedir}/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>

'project.build.directory' represents the directory where all the build artifacts goes. These properties values change from project to project.

To see actual values of these properties, go to the pom file location of your project and execute the command 'mvn help:effective-pom'.


Above properties will be replaced with actual values.

<sourceDirectory>C:\Users\krishna\Documents\Study\Maven\projects\helloWorld\src\main\java</sourceDirectory>
<scriptSourceDirectory>C:\Users\krishna\Documents\Study\Maven\projects\helloWorld\src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>C:\Users\krishna\Documents\Study\Maven\projects\helloWorld\src\test\java</testSourceDirectory>
<outputDirectory>C:\Users\krishna\Documents\Study\Maven\projects\helloWorld\target\classes</outputDirectory>
<testOutputDirectory>C:\Users\krishna\Documents\Study\Maven\projects\helloWorld\target\test-classes</testOutputDirectory>



Previous                                                    Next                                                    Home

Maven: Effective POM


In my previous post, I explained about super pom. By default all the pom files inherit the information from super pom file.

pom.xml
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>selfLearningJava</groupId>
   <artifactId>helloworld</artifactId>
   <packaging>jar</packaging>
   <version>1</version>
   <name>helloworld</name>
</project>

For example, if you would like to see the final pom, after inheriting from super pom, then go to the directory, where your pom.xml file is located and run below command


mvn help:effective-pom


Previous                                                    Next                                                    Home