Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to update plugins #292

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@
is not compatible with project minimum version, not really a proposed
upgrade

* [Fixed Issue 237][issue-237]
* [Fixed Issue 237][issue-237] and [Fixed Issue 288][issue-288]

Thanks to Julian Di Leonardo <[email protected]>
Thanks to Julian Di Leonardo <[email protected]> and [Adam Voss](https://github.com/adamvoss)

Adding parent processing to UseLatestVersion/UseLatestSnapshot/UseLatestRelease
Added parent processing to:
- UseLatestVersion
- UseLatestSnapshot
- UseLatestRelease
- ForceReleases
- UseDepVersion
- UseNextReleases
- UseNextSnapshots
- UseNextVersions

* [Fixed Issue 190][issue-190]

Expand All @@ -44,6 +52,12 @@

* [Fixed Issue 215][issue-215]

* [Fixed Issue 8][issue-8]

_Thanks to [Adam Voss](https://github.com/adamvoss)_

Many of the goals can now update plugins if you set the `processPlugins` property.

## 2.5


Expand Down Expand Up @@ -131,6 +145,7 @@



[issue-8]: https://github.com/mojohaus/versions-maven-plugin/issues/8
[issue-34]: https://github.com/mojohaus/versions-maven-plugin/issues/34
[issue-37]: https://github.com/mojohaus/versions-maven-plugin/issues/37
[issue-46]: https://github.com/mojohaus/versions-maven-plugin/issues/46
Expand All @@ -153,6 +168,7 @@
[issue-198]: https://github.com/mojohaus/versions-maven-plugin/issues/198
[issue-237]: https://github.com/mojohaus/versions-maven-plugin/issues/237
[issue-256]: https://github.com/mojohaus/versions-maven-plugin/issues/256
[issue-288]: https://github.com/mojohaus/versions-maven-plugin/issues/288

[pull-189]: https://github.com/mojohaus/versions-maven-plugin/pull/189
[pull-252]: https://github.com/mojohaus/versions-maven-plugin/pull/252
1 change: 1 addition & 0 deletions src/it/it-use-latest-releases-008/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases
31 changes: 31 additions & 0 deletions src/it/it-use-latest-releases-008/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-use-latest-releases-008</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Updates a plugin when processPlugins is true</name>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<processPlugins>true</processPlugins>
</configuration>
</plugin>

<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
</plugin>

</plugins>
</build>

</project>
21 changes: 21 additions & 0 deletions src/it/it-use-latest-releases-008/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "pom.xml" );
String buf = FileUtils.fileRead( file, "UTF-8" );

if ( buf.indexOf( "<version>3.1</version>" ) < 0 )
{
System.err.println( "Version of dummy-maven-plugin not bumped to 3.1" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
1 change: 1 addition & 0 deletions src/it/it-use-latest-releases-009/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases
49 changes: 49 additions & 0 deletions src/it/it-use-latest-releases-009/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-use-latest-releases-008</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Does not update plugins when processPlugins is false (default)</name>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</plugin>

<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
</plugin>

</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</pluginManagement>

</build>

<reporting>
<plugins>
<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</reporting>

</project>
21 changes: 21 additions & 0 deletions src/it/it-use-latest-releases-009/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "pom.xml" );
String buf = FileUtils.fileRead( file, "UTF-8" );

if ( buf.indexOf( "<version>1.0</version>" ) < 0 || buf.indexOf( "<version>3.1</version>" ) > 0 )
{
System.err.println( "Version of dummy-maven-plugin was changed. Should have stayed at 1.0." );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
1 change: 1 addition & 0 deletions src/it/it-use-next-releases-005/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-next-releases
39 changes: 39 additions & 0 deletions src/it/it-use-next-releases-005/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>localhost</groupId>
<artifactId>dummy-parent</artifactId>
<version>1.0</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-use-next-releases-005</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Update a parent dependency</name>

<dependencies>

<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-impl</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<processParent>true</processParent>
</configuration>
</plugin>
</plugins>
</build>

</project>
33 changes: 33 additions & 0 deletions src/it/it-use-next-releases-005/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import java.io.*;
import java.util.regex.*;

try
{
File file = new File( basedir, "pom.xml" );

BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) );
StringBuilder buf = new StringBuilder();
String line = in.readLine();
while ( line != null )
{
buf.append( line );
buf.append( " " );
line = in.readLine();
}

Pattern p = Pattern.compile( "\\Q<parent>\\E.*\\Q<version>\\E\\s*2\\.0\\s*\\Q</version>\\E.*\\Q</parent>\\E" );
Matcher m = p.matcher( buf.toString() );
if ( !m.find() )
{
System.out.println( "Did not update parent to version 2.0" );
return false;
}
System.out.println( m.group( 0 ) );
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
1 change: 1 addition & 0 deletions src/it/it-use-next-releases-006/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-next-releases
35 changes: 35 additions & 0 deletions src/it/it-use-next-releases-006/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-use-latest-releases-008</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Updates a reporting plugin when processPlugins is true</name>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<processPlugins>true</processPlugins>
</configuration>
</plugin>

</plugins>
</build>

<reporting>
<plugins>
<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</reporting>

</project>
21 changes: 21 additions & 0 deletions src/it/it-use-next-releases-006/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "pom.xml" );
String buf = FileUtils.fileRead( file, "UTF-8" );

if ( buf.indexOf( "<version>2.0</version>" ) < 0 )
{
System.err.println( "Version of dummy-maven-plugin not bumped to 2.0" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
1 change: 1 addition & 0 deletions src/it/it-use-next-versions-004/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-next-versions
35 changes: 35 additions & 0 deletions src/it/it-use-next-versions-004/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-use-latest-releases-008</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Updates a plugin in pluginManagement when processPlugins is true</name>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<processPlugins>true</processPlugins>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>

</build>

</project>
21 changes: 21 additions & 0 deletions src/it/it-use-next-versions-004/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "pom.xml" );
String buf = FileUtils.fileRead( file, "UTF-8" );

if ( buf.indexOf( "<version>2.1</version>" ) < 0 )
{
System.err.println( "Version of dummy-maven-plugin not bumped to 2.1" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
Loading