diff --git a/src/it/it-display-plugin-updates-009-issue-422/invoker.properties b/src/it/it-display-plugin-updates-009-issue-422/invoker.properties
new file mode 100644
index 0000000000..3e9221daf4
--- /dev/null
+++ b/src/it/it-display-plugin-updates-009-issue-422/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:display-plugin-updates
diff --git a/src/it/it-display-plugin-updates-009-issue-422/pom.xml b/src/it/it-display-plugin-updates-009-issue-422/pom.xml
new file mode 100644
index 0000000000..65fef57b3e
--- /dev/null
+++ b/src/it/it-display-plugin-updates-009-issue-422/pom.xml
@@ -0,0 +1,52 @@
+
+ 4.0.0
+
+
+ org.apache
+ apache
+ 23
+
+
+
+ localhost
+ it-101
+ 1.0
+ pom
+ display-plugin-updates
+
+ Make sure display-plugin-updates works if a non-local parent is referenced.
+
+
+ 2.0.6
+
+
+
+
+
+
+ localhost
+ dummy-maven-plugin
+ 1.0
+
+
+ maven-clean-plugin
+ 2.2
+
+
+ maven-deploy-plugin
+ 2.3
+
+
+ maven-install-plugin
+ 2.2
+
+
+ maven-site-plugin
+ 2.0
+
+
+
+
+
+
diff --git a/src/it/it-display-plugin-updates-009-issue-422/verify.bsh b/src/it/it-display-plugin-updates-009-issue-422/verify.bsh
new file mode 100644
index 0000000000..01c880ec33
--- /dev/null
+++ b/src/it/it-display-plugin-updates-009-issue-422/verify.bsh
@@ -0,0 +1,25 @@
+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( "\\Qlocalhost:dummy-maven-plugin\\E\\s*\\.*\\s*1\\.0\\s+->\\s+3\\.1" );
+ Matcher m = p.matcher( buf.toString() );
+ if ( !m.find() )
+ {
+ System.out.println( "Did not suggest updating dummy-maven-plugin to version 3.1" );
+ return false;
+ }
+ System.out.println( m.group( 0 ) );
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
diff --git a/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java b/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java
index adf213dd53..53875d8f43 100644
--- a/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java
+++ b/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java
@@ -70,6 +70,8 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
+
+import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
@@ -769,7 +771,7 @@ private Map getParentsPlugins( List parents )
try
{
Set withVersionSpecified =
- findPluginsWithVersionsSpecified( new StringBuilder( writer.toString() ), parentProject.getFile().getAbsolutePath() );
+ findPluginsWithVersionsSpecified( new StringBuilder( writer.toString() ), getSafeProjectPathInfo(parentProject) );
Map map = getPluginManagement( interpolatedModel );
map.keySet().retainAll( withVersionSpecified );
@@ -797,6 +799,17 @@ private Map getParentsPlugins( List parents )
}
return parentPlugins;
}
+
+ private String getSafeProjectPathInfo(MavenProject project) {
+ File file = project.getFile();
+ if (file != null) {
+ return file.getAbsolutePath();
+ }
+ else {
+ // path is used only as information in error message, we can fallback to project artifact info here
+ return project.toString();
+ }
+ }
private boolean isMavenPluginProject()
{
@@ -850,7 +863,7 @@ public String toString()
private Set findPluginsWithVersionsSpecified( MavenProject project )
throws IOException, XMLStreamException
{
- return findPluginsWithVersionsSpecified( PomHelper.readXmlFile( project.getFile() ), project.getFile().getAbsolutePath() );
+ return findPluginsWithVersionsSpecified( PomHelper.readXmlFile( project.getFile() ), getSafeProjectPathInfo(project) );
}
/**