Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: _Plugin Submission
-
Labels:None
-
Environment:Platform independent
-
Complexity:Intermediate
-
Number of attachments :3
Description
As posted on the Mojo-Dev and Maven-User mailing lists, I've created a properties-maven-plugin which provides I/O functionality for maven properties, a feature often requested on the mailing lists.
The site for the plugin:
http://individual.utoronto.ca/zarar/properties-maven-plugin/site/
My mailing list posts about the plugin:
http://www.nabble.com/properties-maven-plugin-tf2455107.html
http://www.nabble.com/Any-interest-in-a-maven-properties-plugin--tf2454363.html
The source for the plugin is attached. Is it possible for this to be placed in the sandbox so further development may be done on it?
Thanks.
-
- properties.patch
- 26/Apr/08 12:36 PM
- 2 kB
- Tony Dalbrekt
-
Hide
- properties-maven-plugin.zip
- 17/Oct/06 3:29 PM
- 9 kB
- Zarar Siddiqi
-
- properties-maven-plugin/cobertura.ser 5 kB
- properties-maven-plugin/maven-magic-plugin.iml 4 kB
- properties-maven-plugin/pom.xml 1 kB
- properties-maven-plugin/.../AbstractWritePropertiesMojo.java 2 kB
- properties-maven-plugin/.../ReadPropertiesMojo.java 1 kB
- properties-maven-plugin/.../WriteActiveProfileProperties.java 1 kB
- properties-maven-plugin/.../WriteProjectProperties.java 0.6 kB
- properties-maven-plugin/src/.../howto.apt 2 kB
- properties-maven-plugin/src/.../index.apt 0.0 kB
- properties-maven-plugin/.../introduction.apt 0.2 kB
- properties-maven-plugin/src/.../site.xml 0.9 kB
-
- ReadPropertiesMojo.java
- 20/Nov/06 1:36 PM
- 5 kB
- Corporate Gadfly
Activity
Yes, this could be part of the build helper plugin since this is a very common task in the build process.
There are two main use cases for this plugin (maybe more for others):
1. Ability to define Maven properties in a property file
So instead of this:
<properties> <webmaster.name>The Dude</webmaster.name> <webmaster.email>dude@dude.com</webmaster.email> </properties>
we can define them in a property file
webmaster.name=The Dude webmaster.email=dude@dude.com
This will allow developers to easily load different properties based on different environments. Many applications have varying configuration properties for different environments and this would help maintain them in seperate files rather than having everything in a pom and using profiles which many find overkill for such circumstances.
2. Writing ALL Maven properties to a file
Maven properties which were created in pom.xml or loaded via #1 could be written to a file. This comes handy when these properties need to be available at runtime. The best example I can think of is the property files needed to initialize Spring's PropertyPlaceholderConfigurer.
Any decision on this plugin? It will be useful to many people here.
If it's made part of the build-helper plugin, that would work fine too.
Modification for reading properties which includes expansion of ${} tokens against project properties, system properties and environment variables. E.g., if a .properties file contains:
war.dir=${env.HOME}/${env.OS}
and the environment variables HOME and OS have values ABC and Windows_NT
when the property is available to maven, this will be expanded to:
war.dir=ABC/Windows_NT
This is a fabulous idea and a huge help when you are faced with using the
antrun plugin on an ant file that depends on a big properties file.
Tom Nelson
Any chance this plugin could be enhanced to allow overriding of properties in dependent poms?
An updated version of this plugin can be downloaded from here:
http://arsenalist.com/2007/02/07/maven-properties-plugin-download/
It has the additional feature of the properties being defined being able to use other properties.
This plugin gets downloaded a bunch of times everyday and I really don't see why this hasn't been accepted yet.
I apologize, given the amount of votes if you want we can give you access to the sandbox
Sign up at http://xircles.codehaus.org/signup
Request being a project member at http://xircles.codehaus.org/projects/mojo
This is now in SVN:
https://svn.codehaus.org/mojo/trunk/mojo/properties-maven-plugin/
Thanks to everyone for voting. Thanks again Carlos.
moved to the sandbox until released
https://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/properties-maven-plugin/
I need some help here:
http://www.nabble.com/-Vote--properties-maven-plugin-release-tf4094624.html
FYI, the sandbox URL has moved to https://svn.codehaus.org/mojo/trunk/sandbox/properties-maven-plugin/
BTW, I'm still keen to see this plugin released.
To write all project properties to file is not always desirable. The attached patch adds class (goal) WriteProperties which writes properties of your choice to outputFile. It would be nice if you committed this patch and I would also like to see this plugin be released in some way.
Usage:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-SNAPSHOT</version> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>write-properties</goal> </goals> <configuration> <addBuildDate>true</addBuildDate> <properties> <property> <name>project.version</name> <value>${project.version}</value> </property> <property> <name>project.name</name> <value>${project.name}</value> </property> </properties> <outputFile> target/classes/app.properties </outputFile> </configuration> </execution> </execusions> </plugin>
I would still like to understand what this plugin is supposed to do. Sounds to me like it might be something that might fit in the resources or build helper plugins.