You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Raynsford <or...@io7m.com.INVALID> on 2019/07/07 10:08:37 UTC

Finding out what the versions plugin did

Hello!

Is there a machine-readable way I can find out what the Versions plugin
did after I've executed it? I'm writing a CI task that tries to
periodically update the dependencies of a project.

Essentially, the task does this:

$ mvn clean verify
$ mvn -DallowMajorUpdates=false \
  versions:use-latest-releases \
  versions:update-properties
$ mvn clean verify

If the second "clean verify" execution succeeds, then we assume that
all the new dependency versions are fine. The task then goes on to
commit the pom.xml changes.

The problem: I'd like to retrieve the list of dependencies that were
updated (their previous and current versions) so that I can produce a
nice commit message and changelog entry. I can't seem to get this
information out of the plugin.

I've seen the documentation for the dependency-updates-report goal, so
I tried doing this:

$ mvn clean verify
$ mvn \
  -DallowMajorUpdates=false \
  -DdependencyUpdatesReportFormats=xml
  -DoutputDirectory=. \
  versions:dependency-updates-report \
  versions:use-latest-releases \
  versions:update-properties
$ mvn clean verify

But this just doesn't appear to produce any output. Am I doing
something wrong?

Is there some better way to do this?

-- 
Mark Raynsford | http://www.io7m.com


Re: Finding out what the versions plugin did

Posted by Mirko Friedenhagen <mf...@gmx.de>.
Hello,

we do something similar:

GIT_MESSAGE=/tmp/git-message.txt
mvn -B -V -e -l /tmp/maven-logfile versions:use-latest-releases versions:update-properties
cat << EOF > ${GIT_MESSAGE}
mvn -B -V -e -l /tmp/maven-logfile versions:use-latest-releases versions:update-properties

https://git.example.com/tpq/divpom/builds/${CI_JOB_ID} <https://git.example.com/tpq/divpom/builds/$%7BCI_JOB_ID%7D>

EOF
grep '\[INFO\] Updated ' /tmp/maven-logfile >> ${GIT_MESSAGE} && mvn -B -V -e verify || echo "No updates detected“

Regards
Mirko

> Am 07.07.2019 um 13:59 schrieb Tomo Suzuki <suztomo@google.com.INVALID <ma...@google.com.INVALID>>:
> 
> Hi Mark,
> 
> I would either
> 
> 1. try display-dependency-updates and other display-* goals:
> 
> https://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html <https://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html>
> 
> https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html <https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html>
> 
> 
> 2. leverage the backup file(s) created by the versions plugin
> before committing.
> 
> “diff pom.xml pom.xml.versionsBackup”
> 
> Both approaches still require parsing the output though.
> 
> Regards,
> Tomo
> 
> On Sun, Jul 7, 2019 at 06:09 Mark Raynsford
> <org.apache.maven.user@io7m.com.invalid <ma...@io7m.com.invalid>> wrote:
> 
>> Hello!
>> 
>> Is there a machine-readable way I can find out what the Versions plugin
>> did after I've executed it? I'm writing a CI task that tries to
>> periodically update the dependencies of a project.
>> 
>> Essentially, the task does this:
>> 
>> $ mvn clean verify
>> $ mvn -DallowMajorUpdates=false \
>>  versions:use-latest-releases \
>>  versions:update-properties
>> $ mvn clean verify
>> 
>> If the second "clean verify" execution succeeds, then we assume that
>> all the new dependency versions are fine. The task then goes on to
>> commit the pom.xml changes.
>> 
>> The problem: I'd like to retrieve the list of dependencies that were
>> updated (their previous and current versions) so that I can produce a
>> nice commit message and changelog entry. I can't seem to get this
>> information out of the plugin.
>> 
>> I've seen the documentation for the dependency-updates-report goal, so
>> I tried doing this:
>> 
>> $ mvn clean verify
>> $ mvn \
>>  -DallowMajorUpdates=false \
>>  -DdependencyUpdatesReportFormats=xml
>>  -DoutputDirectory=. \
>>  versions:dependency-updates-report \
>>  versions:use-latest-releases \
>>  versions:update-properties
>> $ mvn clean verify
>> 
>> But this just doesn't appear to produce any output. Am I doing
>> something wrong?
>> 
>> Is there some better way to do this?
>> 
>> --
>> Mark Raynsford | http://www.io7m.com <http://www.io7m.com/>
>> 
>> --
> Regards,
> Tomo


Re: Finding out what the versions plugin did

Posted by Mirko Friedenhagen <mf...@gmx.de>.
Hello,

we do something similar:

GIT_MESSAGE=/tmp/git-message.txt
mvn -B -V -e -l /tmp/maven-logfile versions:use-latest-releases versions:update-properties
cat << EOF > ${GIT_MESSAGE}
mvn -B -V -e -l /tmp/maven-logfile versions:use-latest-releases versions:update-properties

https://git.example.com/tpq/divpom/builds/${CI_JOB_ID} <https://git.example.com/tpq/divpom/builds/$%7BCI_JOB_ID%7D>

EOF
grep '\[INFO\] Updated ' /tmp/maven-logfile >> ${GIT_MESSAGE} && mvn -B -V -e verify || echo "No updates detected“

Regards
Mirko

> Am 07.07.2019 um 13:59 schrieb Tomo Suzuki <suztomo@google.com.INVALID <ma...@google.com.INVALID>>:
> 
> Hi Mark,
> 
> I would either
> 
> 1. try display-dependency-updates and other display-* goals:
> 
> https://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html <https://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html>
> 
> https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html <https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html>
> 
> 
> 2. leverage the backup file(s) created by the versions plugin
> before committing.
> 
> “diff pom.xml pom.xml.versionsBackup”
> 
> Both approaches still require parsing the output though.
> 
> Regards,
> Tomo
> 
> On Sun, Jul 7, 2019 at 06:09 Mark Raynsford
> <or...@io7m.com.invalid> wrote:
> 
>> Hello!
>> 
>> Is there a machine-readable way I can find out what the Versions plugin
>> did after I've executed it? I'm writing a CI task that tries to
>> periodically update the dependencies of a project.
>> 
>> Essentially, the task does this:
>> 
>> $ mvn clean verify
>> $ mvn -DallowMajorUpdates=false \
>>  versions:use-latest-releases \
>>  versions:update-properties
>> $ mvn clean verify
>> 
>> If the second "clean verify" execution succeeds, then we assume that
>> all the new dependency versions are fine. The task then goes on to
>> commit the pom.xml changes.
>> 
>> The problem: I'd like to retrieve the list of dependencies that were
>> updated (their previous and current versions) so that I can produce a
>> nice commit message and changelog entry. I can't seem to get this
>> information out of the plugin.
>> 
>> I've seen the documentation for the dependency-updates-report goal, so
>> I tried doing this:
>> 
>> $ mvn clean verify
>> $ mvn \
>>  -DallowMajorUpdates=false \
>>  -DdependencyUpdatesReportFormats=xml
>>  -DoutputDirectory=. \
>>  versions:dependency-updates-report \
>>  versions:use-latest-releases \
>>  versions:update-properties
>> $ mvn clean verify
>> 
>> But this just doesn't appear to produce any output. Am I doing
>> something wrong?
>> 
>> Is there some better way to do this?
>> 
>> --
>> Mark Raynsford | http://www.io7m.com
>> 
>> --
> Regards,
> Tomo


Re: Finding out what the versions plugin did

Posted by Tomo Suzuki <su...@google.com.INVALID>.
Hi Mark,

I would either

1. try display-dependency-updates and other display-* goals:

https://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html

https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html


2. leverage the backup file(s) created by the versions plugin
before committing.

 “diff pom.xml pom.xml.versionsBackup”

Both approaches still require parsing the output though.

Regards,
Tomo

On Sun, Jul 7, 2019 at 06:09 Mark Raynsford
<or...@io7m.com.invalid> wrote:

> Hello!
>
> Is there a machine-readable way I can find out what the Versions plugin
> did after I've executed it? I'm writing a CI task that tries to
> periodically update the dependencies of a project.
>
> Essentially, the task does this:
>
> $ mvn clean verify
> $ mvn -DallowMajorUpdates=false \
>   versions:use-latest-releases \
>   versions:update-properties
> $ mvn clean verify
>
> If the second "clean verify" execution succeeds, then we assume that
> all the new dependency versions are fine. The task then goes on to
> commit the pom.xml changes.
>
> The problem: I'd like to retrieve the list of dependencies that were
> updated (their previous and current versions) so that I can produce a
> nice commit message and changelog entry. I can't seem to get this
> information out of the plugin.
>
> I've seen the documentation for the dependency-updates-report goal, so
> I tried doing this:
>
> $ mvn clean verify
> $ mvn \
>   -DallowMajorUpdates=false \
>   -DdependencyUpdatesReportFormats=xml
>   -DoutputDirectory=. \
>   versions:dependency-updates-report \
>   versions:use-latest-releases \
>   versions:update-properties
> $ mvn clean verify
>
> But this just doesn't appear to produce any output. Am I doing
> something wrong?
>
> Is there some better way to do this?
>
> --
> Mark Raynsford | http://www.io7m.com
>
> --
Regards,
Tomo