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

Fixed #583 #584

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/it/it-use-releases-issue-583/invoker.properties
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-releases -DallowRangeMatching=true -DfailIfNotReplaced=true
21 changes: 21 additions & 0 deletions src/it/it-use-releases-issue-583/pom.xml
@@ -0,0 +1,21 @@
<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-releases-issue-583</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Skip a dependency without version</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

</project>
23 changes: 23 additions & 0 deletions src/it/it-use-releases-issue-583/verify.bsh
@@ -0,0 +1,23 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;
import java.util.regex.*;

try
{
File file = new File( basedir, "build.log" );
String buf = FileUtils.fileRead( file );
Pattern p = Pattern.compile( "\\QIgnoring dependency with no version: localhost:dummy-api:jar\\E" );
Matcher m = p.matcher( buf.toString() );
if ( !m.find() )
{
System.out.println( "cannot find skipping of dummy-api dependency" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
Expand Up @@ -190,7 +190,7 @@ public boolean isExcludeReactor()
*/
protected boolean isHandledByProperty(Dependency dependency) {
String version = dependency.getVersion();
return version.startsWith("${");
return version != null && version.startsWith("${");
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java
Expand Up @@ -209,6 +209,11 @@ private void useReleases( ModifiedPomXMLEventReader pom, Collection<Dependency>
}

String version = dep.getVersion();
if ( version == null )
{
getLog().info( "Ignoring dependency with no version: " + toString( dep ) );
continue;
}
Matcher versionMatcher = matchSnapshotRegex.matcher( version );
if ( versionMatcher.matches() )
{
Expand Down