Konrad Windszus created MNG-5993:
------------------------------------

             Summary: Confusing error message in case of missing/empty 
artifactId and version in pluginManagement
                 Key: MNG-5993
                 URL: https://issues.apache.org/jira/browse/MNG-5993
             Project: Maven
          Issue Type: Improvement
          Components: Dependencies
    Affects Versions: 3.3.9
            Reporter: Konrad Windszus


Executing any goals/phases on this pom.xml leads to a weird error
{code}
<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>com.example.group</groupId>
  <artifactId>testinvalidpom</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId></groupId>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>
</project>
{code}

The error being emitted is 
{code}
[ERROR] Error resolving version for plugin ':null' from the repositories [local 
(<some path>), nexus (<some remote repo url>)]: Plugin not found in any plugin 
repository -> [Help 1]
{code}

Even with debug you only see something like this 
{code}
[ERROR] Error resolving version for plugin ':null' from the repositories [...]: 
Plugin not found in any plugin repository -> [Help 1]
org.apache.maven.plugin.version.PluginVersionResolutionException: Error 
resolving version for plugin ':null' from the repositories [local 
(/Users/konradwindszus/.m2/repository), nexus 
(https://repo.int.netcentric.biz/nexus/content/groups/public/)]: Plugin not 
found in any plugin repository
        at 
org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.selectVersion(DefaultPluginVersionResolver.java:236)
        at 
org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.resolveFromRepository(DefaultPluginVersionResolver.java:148)
        at 
org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.resolve(DefaultPluginVersionResolver.java:96)
        at 
org.apache.maven.lifecycle.internal.LifecyclePluginResolver.resolveMissingPluginVersions(LifecyclePluginResolver.java:89)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:135)
        at 
org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:97)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
{code}

In this example the error is easy to spot, but for bigger pom.xmls with more 
complex hierarchies it is very hard.
Some basic validation should take place that on the merged pom.xml all of 
groupId, artifactId and version is available and if that is not the case, the 
line number of the pom.xml together with the filename should be given out, 
where the according information is missing.

A similar error is emitted in case the groupId element is missing as well or 
there is an empty artifactId.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to