diff --git a/src/it/it-set-024-versionless-dependency/child/pom.xml b/src/it/it-set-024-versionless-dependency/child/pom.xml new file mode 100644 index 0000000000..92fcf1a5d7 --- /dev/null +++ b/src/it/it-set-024-versionless-dependency/child/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + + + localhost + test-artifact + 1.0 + + + child + + \ No newline at end of file diff --git a/src/it/it-set-024-versionless-dependency/invoker.properties b/src/it/it-set-024-versionless-dependency/invoker.properties new file mode 100644 index 0000000000..26c0549d71 --- /dev/null +++ b/src/it/it-set-024-versionless-dependency/invoker.properties @@ -0,0 +1 @@ +invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:set -DprocessDependencies=true, -DartifactId=child -DoldVersion=1.0 -DnewVersion=2.0 \ No newline at end of file diff --git a/src/it/it-set-024-versionless-dependency/pom.xml b/src/it/it-set-024-versionless-dependency/pom.xml new file mode 100644 index 0000000000..a5c323139a --- /dev/null +++ b/src/it/it-set-024-versionless-dependency/pom.xml @@ -0,0 +1,22 @@ + + 4.0.0 + localhost + test-artifact + 1.0 + pom + + + + + localhost + dummy-api + 1.1 + + + + + + child + + \ No newline at end of file diff --git a/src/main/java/org/codehaus/mojo/versions/SetMojo.java b/src/main/java/org/codehaus/mojo/versions/SetMojo.java index edb7c066c1..0a712535e2 100644 --- a/src/main/java/org/codehaus/mojo/versions/SetMojo.java +++ b/src/main/java/org/codehaus/mojo/versions/SetMojo.java @@ -342,27 +342,25 @@ public void execute() throws MojoExecutionException, MojoFailureException getLog().info( "Processing change of " + groupId + ":" + artifactId + ":" + oldVersion + " -> " + newVersion ); - Pattern groupIdRegex = - Pattern.compile( RegexUtils.convertWildcardsToRegex( fixNullOrEmpty( groupId, "*" ), true ) ); - Pattern artifactIdRegex = - Pattern.compile( RegexUtils.convertWildcardsToRegex( fixNullOrEmpty( artifactId, "*" ), true ) ); - Pattern oldVersionIdRegex = - Pattern.compile( RegexUtils.convertWildcardsToRegex( fixNullOrEmpty( oldVersion, "*" ), true ) ); + Pattern groupIdRegex = Pattern.compile( fixNullOrEmpty( groupId, ".*" ) ); + Pattern artifactIdRegex = Pattern.compile( fixNullOrEmpty( artifactId, ".*" ) ); + Pattern oldVersionIdRegex = Pattern.compile( fixNullOrEmpty( oldVersion, ".*" ) ); boolean found = false; for ( Model m : reactor.values() ) { final String mGroupId = PomHelper.getGroupId( m ); final String mArtifactId = PomHelper.getArtifactId( m ); final String mVersion = PomHelper.getVersion( m ); - if ( ( ( groupIdRegex.matcher( mGroupId ).matches() && artifactIdRegex.matcher( mArtifactId ) - .matches() ) // - || ( processAllModules ) ) // - && oldVersionIdRegex.matcher( mVersion ).matches() && !newVersion.equals( mVersion ) ) + if ( ( processAllModules + || groupIdRegex.matcher( mGroupId ).matches() + && artifactIdRegex.matcher( mArtifactId ).matches() ) + && oldVersionIdRegex.matcher( mVersion ).matches() + && !newVersion.equals( mVersion ) ) { found = true; // if the change is not one we have swept up already applyChange( project, reactor, files, mGroupId, m.getArtifactId(), - StringUtils.isBlank( oldVersion ) || "*".equals( oldVersion ) ? "" : m.getVersion() ); + StringUtils.isBlank( oldVersion ) || "*".equals( oldVersion ) ? "" : mVersion ); } } if ( !found && RegexUtils.getWildcardScore( groupId ) == 0 && RegexUtils.getWildcardScore( artifactId ) == 0