You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Aaron Digulla <di...@hepe.com> on 2008/07/28 15:23:59 UTC

Re: Is there a way to use a property as the version of a parent pom?

Quoting Ralph Goers <Ra...@dslextreme.com>:

> It is currently working as designed. Maven won't resolve properties for
> any of the items in the parent section. The pom below would be a
> problem if it was actually installed into a repository as it would
> require that the property be specified even if the artifact was a
> transitive dependency.

I don't follow you here. In the parent pom.xml, I use normal version  
numbers. All I want is that the current pom.xml allows a property as  
the version of the parent POM. Even if the current POM gets installed  
in a repository, it's no problem because (just like when it's local),  
the property must be set when it's loaded/resolved/whatever.

I mean, the repository server isn't going to try to use that string  
for anything, is it? Maven will download the file, parse it and  
complain if the property isn't set.

> I am working on a modification that allows the version to be obtained
> by reading the pom located at the relativePath and getting the version
> from it, but I still have a couple of issues to resolve. It wouldn't
> solve your case though, as even there it won't actually accept a system
> property for the version.

Does that mean that I could omit the version tag and just use  
relativePath? That would work for me. Is that patch for 2.0 or 2.1?

What is the most simple way to include common dependencies, plugin  
configs and properties in many POMs?

I'm using <parent> but as it is, I have to update the version numbers  
in about 100 files when I change the different parent POMs (and no,  
the parent pom is not "../pom.xml"; it's somewhere else in the tree  
and I have three different "parent" POMs).

I'm aware that there are plans to allow "includes" in Maven 2.1 but  
I'd like a solution for 2.0.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Aaron Digulla <di...@hepe.com>.
Quoting Ralph Goers <Ra...@dslextreme.com>:

>>> It is currently working as designed. Maven won't resolve properties for
>>> any of the items in the parent section. The pom below would be a
>>> problem if it was actually installed into a repository as it would
>>> require that the property be specified even if the artifact was a
>>> transitive dependency.
>>
>> I don't follow you here. In the parent pom.xml, I use normal   
>> version numbers. All I want is that the current pom.xml allows a   
>> property as the version of the parent POM. Even if the current POM   
>> gets installed in a repository, it's no problem because (just like   
>> when it's local), the property must be set when it's   
>> loaded/resolved/whatever.
> This is a problem. Anyone who wants to use your artifact, or anyone who
> wants to use an artifact which uses your artifact would have to set the
> property. Worse, they really wouldn't have any idea what the proper
> version should be.

Well, we need this only internally. Then, if you really wanted to, you  
could add a comment to the pom to give a hint which version to use and  
you could give an explanation in the website.

And if all else fails, you could just look in the repository to see  
which versions are available. I mean, this is not some info which has  
no context. This is part of a project and that means that you have  
more ways to transfer this information (which is vital since you need  
that feature).

>> Does that mean that I could omit the version tag and just use   
>> relativePath? That would work for me. Is that patch for 2.0 or 2.1?
> No, you would need the version tag with the version being a "special"
> symbol. While omitting the version would be nice I'm sure it would
> break all kinds of existing use cases and that can't be tolerated.  I
> am targeting 2.0, but only if I can be sure it won't break any builds.

And timeframe for a patch to try?

>> I'm aware that there are plans to allow "includes" in Maven 2.1 but  
>>  I'd like a solution for 2.0.
> I'm not really sure what you mean by this. I'm not aware of "includes".

In 2.1, you can build a POM by using fragments (I don't remember the  
real name and I couldn't find anything in the Wiki right now). It's  
kind of like having several parent POMs where each of them adds a  
certain piece of info.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Ralph Goers <Ra...@dslextreme.com>.
Sorry for not answering sooner. I was travelling today. Comments are below.

Aaron Digulla wrote:
> Quoting Ralph Goers <Ra...@dslextreme.com>:
>
>> It is currently working as designed. Maven won't resolve properties for
>> any of the items in the parent section. The pom below would be a
>> problem if it was actually installed into a repository as it would
>> require that the property be specified even if the artifact was a
>> transitive dependency.
>
> I don't follow you here. In the parent pom.xml, I use normal version 
> numbers. All I want is that the current pom.xml allows a property as 
> the version of the parent POM. Even if the current POM gets installed 
> in a repository, it's no problem because (just like when it's local), 
> the property must be set when it's loaded/resolved/whatever.
This is a problem. Anyone who wants to use your artifact, or anyone who 
wants to use an artifact which uses your artifact would have to set the 
property. Worse, they really wouldn't have any idea what the proper 
version should be.
>
> I mean, the repository server isn't going to try to use that string 
> for anything, is it? Maven will download the file, parse it and 
> complain if the property isn't set.
No, the respository wouldn't use that string directly. But having the 
pom in the repository with the parent version as a variable means that 
no one would know for sure  what the parent version actually is.
>
>> I am working on a modification that allows the version to be obtained
>> by reading the pom located at the relativePath and getting the version
>> from it, but I still have a couple of issues to resolve. It wouldn't
>> solve your case though, as even there it won't actually accept a system
>> property for the version.
>
> Does that mean that I could omit the version tag and just use 
> relativePath? That would work for me. Is that patch for 2.0 or 2.1?
No, you would need the version tag with the version being a "special" 
symbol. While omitting the version would be nice I'm sure it would break 
all kinds of existing use cases and that can't be tolerated.  I am 
targeting 2.0, but only if I can be sure it won't break any builds.
>
> What is the most simple way to include common dependencies, plugin 
> configs and properties in many POMs?
>
> I'm using <parent> but as it is, I have to update the version numbers 
> in about 100 files when I change the different parent POMs (and no, 
> the parent pom is not "../pom.xml"; it's somewhere else in the tree 
> and I have three different "parent" POMs).
I have the same problem, which is why I am attempting to solve this. 
"Standard" maven practice seems to be to use the release plugin and bump 
up the version numbers even though nothing at all changes. My builds 
don't do this. We only change the version numbers of projects that have 
actual modifications, so having to change the version in the pom is 
really annoying.
>
> I'm aware that there are plans to allow "includes" in Maven 2.1 but 
> I'd like a solution for 2.0.
I'm not really sure what you mean by this. I'm not aware of "includes".

Ralph

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Stephen Connolly <st...@gmail.com>.
On Tue, Jul 29, 2008 at 9:29 AM, Aaron Digulla <di...@hepe.com> wrote:

> Quoting Stephen Connolly <st...@gmail.com>:
>
>  you can use -DparentVersion=[1.3.4]
>>
>> to force a specific version and it rewrites the pom without changing
>> any formatting or comments
>>
>
> That sounds very promising!
>
> In fact, I've just downloaded the "patch" and found it's a complete plugin.
>
> Here are a few suggestions:
>
> 1. Create a new project on CodeHaus for this plugin instead of trying to
> get this plugin into maven core.
>

This is not a "patch" but a request for a plugin to be added to codehaus...
so done already!.


>
> 2. Rename the plugin to "pom" (for pom modification)


Well there are some other goals I intend to add that make the
versions-maven-plugin a better name


>
> 3. Make the plugin more general, i.e. allow to specify a simple XPath on
> the command-line and a replacement. Kind of XML search'n'replace.
>

I'm more interested in version related stuff...., but I don't have
objections to splitting the pom rewriting stuff (it needs some improvements)
into a shared module and having a second plugin to do the other stuff.


> 4. Work on the current POM and all POMs in all sub-modules.


It actually does this already... but in a safer way than you'd think!

It only updates the parent of projects who's parent is _not in the
reactor_.  If we updated the parent of projects who's parent was in the
reactor we'd break the build!


>
>
> Since I need this pretty urgent, I'm willing to help to develop this. I'll
> send you a patch to your private address later today.
>

We need to get a codehaus committer to buy into putting it into sandbox and
giving me & you commit access to sandbox



>
>
> Regards,
>
> --
> Aaron "Optimizer" Digulla a.k.a. Philmann Dark
> "It's not the universe that's limited, it's our imagination.
> Follow me and I'll show you something beyond the limits."
> http://www.pdark.de/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Is there a way to use a property as the version of a parent pom?

Posted by Aaron Digulla <di...@hepe.com>.
Quoting Stephen Connolly <st...@gmail.com>:

> you can use -DparentVersion=[1.3.4]
>
> to force a specific version and it rewrites the pom without changing
> any formatting or comments

That sounds very promising!

In fact, I've just downloaded the "patch" and found it's a complete plugin.

Here are a few suggestions:

1. Create a new project on CodeHaus for this plugin instead of trying  
to get this plugin into maven core.

2. Rename the plugin to "pom" (for pom modification)

3. Make the plugin more general, i.e. allow to specify a simple XPath  
on the command-line and a replacement. Kind of XML search'n'replace.

4. Work on the current POM and all POMs in all sub-modules.

Since I need this pretty urgent, I'm willing to help to develop this.  
I'll send you a patch to your private address later today.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Stephen Connolly <st...@gmail.com>.
you can use -DparentVersion=[1.3.4]

to force a specific version and it rewrites the pom without changing  
any formatting or comments

Sent from my iPod

On 28 Jul 2008, at 16:51, Aaron Digulla <di...@hepe.com> wrote:

> Quoting Stephen Connolly <st...@gmail.com>:
>
>>> What is the most simple way to include common dependencies, plugin  
>>> configs
>>> and properties in many POMs?
>>> [...]
>> please vote for http://jira.codehaus.org/browse/MOJO-1178
>>
>> This has a goal called update-parent that will update the parent  
>> version in
>> the pom to the latest available.
>
> Dear me, no! What I want is to update to a specific version. Also,  
> rewriting the POM.xml means that I'll loose all comments and  
> formatting. No thanks.
>
> Regards,
>
> -- 
> Aaron "Optimizer" Digulla a.k.a. Philmann Dark
> "It's not the universe that's limited, it's our imagination.
> Follow me and I'll show you something beyond the limits."
> http://www.pdark.de/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Aaron Digulla <di...@hepe.com>.
Quoting Stephen Connolly <st...@gmail.com>:

>> What is the most simple way to include common dependencies, plugin configs
>> and properties in many POMs?
>> [...]
> please vote for http://jira.codehaus.org/browse/MOJO-1178
>
> This has a goal called update-parent that will update the parent version in
> the pom to the latest available.

Dear me, no! What I want is to update to a specific version. Also,  
rewriting the POM.xml means that I'll loose all comments and  
formatting. No thanks.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.pdark.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Is there a way to use a property as the version of a parent pom?

Posted by Stephen Connolly <st...@gmail.com>.
On Mon, Jul 28, 2008 at 2:23 PM, Aaron Digulla <di...@hepe.com> wrote:

> Quoting Ralph Goers <Ra...@dslextreme.com>:
>
>  It is currently working as designed. Maven won't resolve properties for
>> any of the items in the parent section. The pom below would be a
>> problem if it was actually installed into a repository as it would
>> require that the property be specified even if the artifact was a
>> transitive dependency.
>>
>
> I don't follow you here. In the parent pom.xml, I use normal version
> numbers. All I want is that the current pom.xml allows a property as the
> version of the parent POM. Even if the current POM gets installed in a
> repository, it's no problem because (just like when it's local), the
> property must be set when it's loaded/resolved/whatever.
>
> I mean, the repository server isn't going to try to use that string for
> anything, is it? Maven will download the file, parse it and complain if the
> property isn't set.
>
>  I am working on a modification that allows the version to be obtained
>> by reading the pom located at the relativePath and getting the version
>> from it, but I still have a couple of issues to resolve. It wouldn't
>> solve your case though, as even there it won't actually accept a system
>> property for the version.
>>
>
> Does that mean that I could omit the version tag and just use relativePath?
> That would work for me. Is that patch for 2.0 or 2.1?
>
> What is the most simple way to include common dependencies, plugin configs
> and properties in many POMs?
>
> I'm using <parent> but as it is, I have to update the version numbers in
> about 100 files when I change the different parent POMs (and no, the parent
> pom is not "../pom.xml"; it's somewhere else in the tree and I have three
> different "parent" POMs).
>
> I'm aware that there are plans to allow "includes" in Maven 2.1 but I'd
> like a solution for 2.0.
>

please vote for http://jira.codehaus.org/browse/MOJO-1178

This has a goal called update-parent that will update the parent version in
the pom to the latest available.

You can then use a compositional pom to invoke the goal on all the trees of
projects and they will all have their parent version updated... and you can
then just promote all these changes to SCM in one go


>
>
> Regards,
>
> --
> Aaron "Optimizer" Digulla a.k.a. Philmann Dark
> "It's not the universe that's limited, it's our imagination.
> Follow me and I'll show you something beyond the limits."
> http://www.pdark.de/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>