Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: Overview for the values of Maven properties

I would like to find out the values of all Maven properties as they apply to some Maven project.
mvn help:system lists OS environment variables and JVM system properties, but no Maven properties.
mvn help:evaluate only works in an interactive mode, that means I have to type a single Maven property, (e.g. ${project.build.outputDirectory}) to get the value of that property.

I'm looking for a way get a full list of all Maven properties and their values.

like image 557
Abdull Avatar asked Sep 07 '12 11:09

Abdull


People also ask

What are Maven properties?

Maven properties are value placeholders, like properties in Ant. Their values are accessible anywhere within a POM by using the notation ${X}, where X is the property. Or they can be used by plugins as default values, for example: In your case you have defined properties as version of java.

How read POM properties file in Java?

Use the properties-maven-plugin to write specific pom properties to a file at compile time, and then read that file at run time.

What is groupId in Maven?

groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org. apache. maven.

What is project Basedir in Maven?

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.


1 Answers

As a workaround, add this to the <plugins> ... </plugins> section inside your project's pom.xml:

<plugin>   <groupId>org.apache.maven.plugins</groupId>   <artifactId>maven-antrun-plugin</artifactId>   <version>1.7</version>   <executions>     <execution>       <phase>validate</phase>       <goals>         <goal>run</goal>       </goals>       <configuration>         <tasks>           <echoproperties />         </tasks>       </configuration>     </execution>   </executions> </plugin> 

Now execute mvn validate.
On the console, prefixed with [echoproperties], there will be the full list of system properties, including those set by Maven such as project.build.outputDirectory, basedir, and settings.localRepository.

like image 134
Abdull Avatar answered Sep 18 '22 04:09

Abdull