Issue Details (XML | Word | Printable)

Key: MOJO-535
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Zarar Siddiqi
Votes: 16
Watchers: 16
Operations

If you were logged in you would be able to see more operations.
Mojo

Submission of properties-maven-plugin

Created: 17/Oct/06 03:29 PM   Updated: 26/Apr/08 12:36 PM   Resolved: 06/Jun/07 03:47 PM
Return to search
Component/s: _Plugin Submission
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive properties-maven-plugin.zip (9 kB)
2. Text File properties.patch (2 kB)
3. Java Source File ReadPropertiesMojo.java (5 kB)

Environment: Platform independent

Complexity: Intermediate


 Description  « Hide

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.



Trygve Laugstol added a comment - 18/Oct/06 02:29 AM

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.


Zarar Siddiqi added a comment - 18/Oct/06 08:31 AM

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.


Zarar Siddiqi added a comment - 25/Oct/06 04:14 PM

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.


Corporate Gadfly added a comment - 20/Nov/06 01:36 PM

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

Corporate Gadfly made changes - 20/Nov/06 01:36 PM
Field Original Value New Value
Attachment ReadPropertiesMojo.java [ 24066 ]
tom nelson added a comment - 06/Mar/07 06:42 PM

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


Matt Raible added a comment - 06/Mar/07 06:55 PM

Any chance this plugin could be enhanced to allow overriding of properties in dependent poms?

http://jira.codehaus.org/browse/MNG-2757


Zarar Siddiqi added a comment - 07/Mar/07 11:44 AM

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.


Carlos Sanchez added a comment - 06/Jun/07 12:57 PM

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


Carlos Sanchez added a comment - 06/Jun/07 03:10 PM

added Zarar to the project


Zarar Siddiqi added a comment - 06/Jun/07 03:47 PM

This is now in SVN:

https://svn.codehaus.org/mojo/trunk/mojo/properties-maven-plugin/

Thanks to everyone for voting. Thanks again Carlos.


Zarar Siddiqi made changes - 06/Jun/07 03:47 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Carlos Sanchez added a comment - 06/Jun/07 03:50 PM

Zarar Siddiqi added a comment - 18/Jul/07 01:50 PM

Daniel Harvey added a comment - 28/Dec/07 09:41 PM

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.


Tony Dalbrekt added a comment - 26/Apr/08 12:36 PM

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>

Tony Dalbrekt made changes - 26/Apr/08 12:36 PM
Attachment properties.patch [ 34173 ]