Thanks for the diskussion. I am pretty sure that neither 
versions:use-latest-versions nor versions:use-latest-releases work out because 
they never downgrade a version and the later does not change snapshots. There 
is a similar issue in https://jira.codehaus.org/browse/MVERSIONS-85 and there 
is the source code patch for the modification suggested by 
byteflin...@gmail.com. The same posts mentions a goal versions:force-releases 
which hopefully appears in the next release and fixed this issue. 

So I will wait until the next release of versions-maven plugin. Until then I am 
going to use this shell script:

sed -i 
's/<dependency>.*-SNAPSHOT<\/dependency>/<dependency>0.0.1<\/dependency>/g' 
pom.xml
mvn versions:use-latest-versions

It will replace all snapshot dependencies with 0.0.1 and then update to the 
latest release. If I want a project to contain not the latest version I am 
going to configure the maven versions plugin using the "exlude" property in 
that projects pom.xml


-----Original Message-----
From: jieryn [mailto:jie...@gmail.com] 
Sent: Thursday, July 24, 2014 8:58 PM
To: user@mojo.codehaus.org
Subject: Re: [mojo-user] Maven Release and Version plugin

http://mojo.codehaus.org/versions-maven-plugin/use-latest-versions-mojo.html

On Thu, Jul 24, 2014 at 2:50 PM, Byte Flinger <byteflin...@gmail.com> wrote:
> As mentioned the use-latest-releases mojo does not work for going from 
> snapshot to latest release. It only works if your pom is already 
> pointing to a release version of a dependency and you want to bump it to the 
> latest.
>
> Having said that this is something the plugin code is explicitly doing 
> on purpose so it is a simple matter to modify the source to take 
> snapshots into account too (though annoying as hell and unnecessary).
>
> On 24 Jul 2014 20:45, "jieryn" <jie...@gmail.com> wrote:
>>
>> You're doing it wrong, then.
>>
>> On Thu, Jul 24, 2014 at 2:12 PM, Jay Askren <jay.ask...@gmail.com> wrote:
>> > Tried that.  Had trouble getting it to work with our setup.  Sent 
>> > an email to the list and got no response.  The solution we created 
>> > allows us to choose a different version than the latest on the rare 
>> > occasions that we might want to.  Just google "maven release 
>> > plugin" problems and you will see why we moved away from the maven 
>> > release plugin.
>> >
>> >
>> >
>> >
>> > On Thu, Jul 24, 2014 at 11:56 AM, jieryn <jie...@gmail.com> wrote:
>> >>
>> >> Holy cow! Wow, just use the versions-maven-plugin, and dump that 
>> >> crazy process.
>> >>
>> >>
>> >>
>> >> http://mojo.codehaus.org/versions-maven-plugin/use-latest-releases
>> >> -mojo.html
>> >>
>> >> On Thu, Jul 24, 2014 at 1:49 PM, Jay Askren <jay.ask...@gmail.com>
>> >> wrote:
>> >> > We've been dealing with this same problem.  We ended up using 
>> >> > the Maven Metadata Plugin for Jenkins to list all of the 
>> >> > versions and default to the latest release.  Then before running 
>> >> > the maven build, we run a groovy script that we wrote to search 
>> >> > through all the poms (we have a multi-module project), and 
>> >> > replace the versions with the correct version from the Maven 
>> >> > Metadata Plugin.  It seems to work pretty well.  This way it 
>> >> > will default to the latest release, but we can override it if 
>> >> > desired.
>> >> >
>> >> >
>> >> > On Thu, Jul 24, 2014 at 10:46 AM, Byte Flinger 
>> >> > <byteflin...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> It's funny you mention that. I just spent the last hour trying 
>> >> >> to do the exact same thing.
>> >> >> Its quite an annoyance that there is no simple way of telling 
>> >> >> the plugin to do that.
>> >> >>
>> >> >> You'd expect that use-latest-releases mojo would do the trick 
>> >> >> but it does not. It ignores snapshot dependencies and only 
>> >> >> works if the dependency is not snapshot.
>> >> >>
>> >> >> I think the only solution at the moment is to simply either 
>> >> >> write your own plugin or run your own modified version of the 
>> >> >> versions plugin.
>> >> >>
>> >> >> On 24 Jul 2014 18:29, "Jan Nehring" 
>> >> >> <jan.nehr...@semperlink.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> Hello Guys,
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> we have a problem with maven releases and maven version 
>> >> >>> plugin. In Jenkins we want to do releases automatically upon 
>> >> >>> pressing a button.
>> >> >>> To
>> >> >>> remove snapshot dependencies we want to use the maven versions 
>> >> >>> plugin.
>> >> >>> Suppose we have two projects A (latest release 0.0.1, latest 
>> >> >>> snapshot
>> >> >>> 0.0.2-SNAPSHOT) and project B with a dependency on ProjectA - 
>> >> >>> 0.0.2-SNAPSHOT and we want to release project B. How can we 
>> >> >>> upgrade project Bs dependencies to the latest available 
>> >> >>> release version? The maven versions plugin goal "use-releases" 
>> >> >>> does not change the 0.0.2-SNAPSHOT dependency because there is 
>> >> >>> no 0.0.2 release version of this project.
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> So my question is: how can we automatically remove snapshot 
>> >> >>> dependencies and replace them with the latest available 
>> >> >>> release version in our scenario?
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> Best regards Jan
>> >> >
>> >> >
>> >>
>> >> ------------------------------------------------------------------
>> >> --- To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to