possible new features

25 views
Skip to first unread message

Magnus Grimsell

unread,
Jun 23, 2009, 9:44:29 AM6/23/09
to maven-config-p...@googlegroups.com
Hi all,

I have a scenario where I think I could use Maven Config Processor but I probably need some more features.
I'd like to hear your opinion on these features and if they fit into the project. Ok, here goes:

1. The property file I need to process is not contained in the project doing the processing. Therefore I'd like to reference a dependency as the input file.

2. Besides changing existing values I'd like to add a bunch of properties. These would be nice to specify as a propertyfile that simply is added the end of the original file.

3. Some of the files I'd like to process are message bundles. Here I would like to replace all values that matches a regexp with a new value.

/Magnus

Leandro de Oliveira

unread,
Jun 23, 2009, 1:30:46 PM6/23/09
to maven-config-p...@googlegroups.com
Hi,

Thanks for your interest in maven config processor.
I think these features surely fit into the project. Here are my thoughts:

1. Do you have a pom.xml demonstrating how you would configure this?

2. I think we could a "file" tag to the xml configuration file like this:
<add>
<file>${mypropertiesfile}</file>
<after>propertyX</after>
</add>

3. If I understand correctly, we'd configure it like this?
<modify>
<regex>expression</regex>
<value>new value</value>
</modify>

The regex matches only property names right? Do you have an example?

[]'s,
Leandro

2009/6/23 Magnus Grimsell <magnus....@idainfront.se>:

grimsell

unread,
Jun 24, 2009, 11:09:01 AM6/24/09
to maven-config-processor-users
1. My thought was to reference a maven artifact as the property file.
<transformation>
<type>properties</type>
<replacePlaceholders>true</replacePlaceholders>
<input>com.foobat:my-properties</input>
...
This way I can deploy a product default configuration file to my
repository. Each project based on the product can then process the
deafault configuration file as a part of the build process.

2. Sounds good.

3. Actually I want to match property values. The scenorio here is
message bundles for a swing client. Buttons, menus etc. has default
labels but project based on the product may want to change these.
Lets say we have a message bundle like this:
com.foobat.newTaskButton=New task
com.foobat.taskMenu=Task...
com.foobat.searchLabel=Nr of tasks

In one project we might want to process the message bundle withe
following result:
com.foobat.newTaskButton=New issue
com.foobat.taskMenu=Issue...
com.foobat.searchLabel=Nr of issues

Leandro de Oliveira

unread,
Jun 24, 2009, 12:13:44 PM6/24/09
to maven-config-p...@googlegroups.com
1. So it is just like what the assembly plugin does to share assembly
descriptors: http://maven.apache.org/plugins/maven-assembly-plugin/examples/sharing-descriptors.html

3. So you want to do a find/replace on property values. I think you
could create a transformation file and a properties file with default
values (both could be shared between projects) and if another project
wants to change the property values, it should define a properties
file with new values. But if you have a really big properties file, we
could add support for regex expressions as well.

2009/6/24 grimsell <grim...@gmail.com>:

grimsell

unread,
Jun 25, 2009, 7:05:03 AM6/25/09
to maven-config-processor-users
1. Yes, something like that was what I had in mind. I'll have a look
at the assembly plugin and see how its done.

3. Well our resource bundles are quite big so I think the regexp
feature would be nice. Also one of the goals here is to be able to
upgrade the product version with little or no changes on the dependant
project.
With a new version message bundle keys can have been added or removed.
With the regexp feature we dont have to care so much about that.

I'll start by having a look at nr 1 and 2.

Leandro de Oliveira

unread,
Jun 25, 2009, 10:05:09 AM6/25/09
to maven-config-p...@googlegroups.com
3. I see. I think we could add new attributes to the "modify"
transformation then, like:
<modify>
<find>regular expression</find>
<replace>new value</replace>
</modify>

> I'll start by having a look at nr 1 and 2.

Are you saying you will help implement these new features? That'd be
nice! I can make you a project member so you will have commit access
to the svn repository.
I'll start to implement number 3 if you agree with my suggestion.

[]'s,
Leandro

2009/6/25 grimsell <grim...@gmail.com>:

grimsell

unread,
Jun 29, 2009, 6:15:54 AM6/29/09
to maven-config-processor-users
3. That sounds great.

> Are you saying you will help implement these new features? That'd be
> nice! I can make you a project member so you will have commit access
> to the svn repository.
> I'll start to implement number 3 if you agree with my suggestion.

Yes, I thought I'd have a look at it and see if I can help.
However, this week is my last before 4 weeks of vaccation so it might
take a while.
I'm not an experienced maven plugin developer either so maybe I need
some help too.

If you beat me to it and implement these feature before I do I'd be
forever thankful :)

If I go ahead and try to implement the dependency-feature I can send
you a patch so I wont need commit access right away.

Leandro de Oliveira

unread,
Jun 30, 2009, 8:09:00 PM6/30/09
to maven-config-p...@googlegroups.com
I will implement number 3.
It would be great if you could help implement the other two.
If you need help, please dont be afraid to ask.

2009/6/29 grimsell <grim...@gmail.com>:

Leandro de Oliveira

unread,
Jun 30, 2009, 9:58:07 PM6/30/09
to maven-config-p...@googlegroups.com
I've uploaded version 1.7-SNAPSHOT with support for find/replace on
properties files.
Please, point you pom.xml to the snapshots repository to test it:
http://maven-config-processor-plugin.googlecode.com/svn/maven-repo/snapshots/

The plugin is replacing property values and comments.

2009/6/30 Leandro de Oliveira <lehp...@gmail.com>:

grimsell

unread,
Jul 1, 2009, 9:05:39 AM7/1/09
to maven-config-processor-users
> I've uploaded version 1.7-SNAPSHOT with support for find/replace on
> properties files.
> Please, point you pom.xml to the snapshots repository to test it:http://maven-config-processor-plugin.googlecode.com/svn/maven-repo/sn...
>
> The plugin is replacing property values and comments.

Cool! I'll have a look at it as soon as possible.

I've also started with the dependency feature. I've created a
enhancement request and uploaded a patch.
http://code.google.com/p/maven-config-processor-plugin/issues/detail?id=10




Leandro de Oliveira

unread,
Jul 11, 2009, 1:51:13 PM7/11/09
to maven-config-p...@googlegroups.com
I've reopened the issue because I forgot about the patch... sorry.
The find/replace feature is now available when processing XML files too.

2009/7/1 grimsell <grim...@gmail.com>:

Leandro de Oliveira

unread,
Jul 18, 2009, 9:59:56 AM7/18/09
to maven-config-p...@googlegroups.com
Appending a file to a properties file is now working too.
You can specify after or before which property to append the file and
the appended file will be processed by maven config processor as well.

2009/7/11 Leandro de Oliveira <lehp...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages