diff --git a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java index 24a76aab2f..0ab084eabf 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java @@ -47,6 +47,6 @@ public class MavenPluginDiscoverer public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorConfiguration, String source ) throws PlexusConfigurationException { - return builder.build( componentDescriptorConfiguration ); + return builder.build( componentDescriptorConfiguration, source ); } } diff --git a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java index 16a287e68f..5dfc56f256 100644 --- a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java +++ b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java @@ -39,6 +39,8 @@ public class PluginDescriptor private String goalPrefix; + private String source; + // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- @@ -109,7 +111,7 @@ public class PluginDescriptor String id = constructPluginKey( groupId, artifactId, version ); if ( groupId == null || artifactId == null || version == null ) { - throw new IllegalStateException( "Plugin descriptor ID incomplete: " + id ); + throw new IllegalStateException( "Plugin descriptor ID incomplete: " + id + " in " + getSource() ); } return id; } @@ -174,4 +176,14 @@ public class PluginDescriptor { return version; } + + public void setSource( String source ) + { + this.source = source; + } + + public String getSource() + { + return source; + } } diff --git a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java index 5fa40b0c73..dd5cfd5ba3 100755 --- a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java +++ b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java @@ -21,11 +21,18 @@ public class PluginDescriptorBuilder { public PluginDescriptor build( Reader reader ) throws PlexusConfigurationException + { + return build( reader, null ); + } + + public PluginDescriptor build( Reader reader, String source ) + throws PlexusConfigurationException { PlexusConfiguration c = buildConfiguration( reader ); PluginDescriptor pluginDescriptor = new PluginDescriptor(); + pluginDescriptor.setSource( source ); pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() ); pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() ); pluginDescriptor.setVersion( c.getChild( "version" ).getValue() );