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 000000000..92fcf1a5d --- /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 000000000..26c0549d7 --- /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 000000000..a5c323139 --- /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 edb7c066c..421ffa6ea 100644 --- a/src/main/java/org/codehaus/mojo/versions/SetMojo.java +++ b/src/main/java/org/codehaus/mojo/versions/SetMojo.java @@ -354,15 +354,16 @@ public void execute() throws MojoExecutionException, MojoFailureException 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