Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

export all defined maven project properties to file?

Tags:

maven

maven-3

I have a maven 3 project. In the POM, I define numerous <properties> - some under <project>, others under specific <profile>. is the a way in maven to export all declared properties to a .properties file?

My current way of doing so is to:

  1. create env.properties file in src/main/resources
  2. for each property 'myProp' add this line to env.properties: myProp=${myProp}
  3. enable resource filtering during builds

Seems like there ought to be a way to eliminate step 2 above...

thanks, -nikita

like image 418
Nikita Avatar asked Feb 07 '12 17:02

Nikita


People also ask

What is properties file in Maven?

Maven supports a hierarchy of different properties to allow specifying defaults and overriding them at the appropriate level. The properties files in Maven are processed in the following order: Built-in properties are processed. ${basedir}/project. properties ( basedir is replaced by the directory where the project.

Where do you add the XML properties file in the Maven project?

properties file in the maven project folder src/main/resources`. In pom. xml, add resources inside the building element and set filtering=true.


1 Answers

Use properties-maven-plugin and its write-project-properties goal.

like image 156
Stevo Slavić Avatar answered Sep 22 '22 06:09

Stevo Slavić