Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5993

Confusing error message in case of missing/empty artifactId and version in pluginManagement

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Dependencies
    • Labels:
      None

      Description

      Executing any goals/phases on this pom.xml leads to a weird error

      <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>
      

      The error being emitted is

      [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]
      

      Even with debug you only see something like this

      [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)
      

      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.

        Issue Links

          Activity

          Hide
          rajivpj Rajiv Jain added a comment -

          I am working on a fix for this issue.

          Show
          rajivpj Rajiv Jain added a comment - I am working on a fix for this issue.
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          Rajiv Jain Are you working on this, cause I haven't seen a PR on github nor an attached patch on this issue? Or did I oversight something?

          Show
          khmarbaise Karl Heinz Marbaise added a comment - Rajiv Jain Are you working on this, cause I haven't seen a PR on github nor an attached patch on this issue? Or did I oversight something?
          Hide
          hudson Hudson added a comment -

          UNSTABLE: Integrated in Jenkins build maven-3.x #1388 (See https://builds.apache.org/job/maven-3.x/1388/)
          MNG-5993 Confusing error message in case of missing/empty (khmarbaise: rev 49cf5d8fb6fb30142e6f91f9d17658e59c54b27f)

          • (edit) maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java
          • (edit) maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-artifactId-pluginManagement.xml
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-plugin-version-pluginManagement.xml
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-groupId-pluginManagement.xml
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-ga-pluginManagement.xml
          • (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
          • (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
          Show
          hudson Hudson added a comment - UNSTABLE: Integrated in Jenkins build maven-3.x #1388 (See https://builds.apache.org/job/maven-3.x/1388/ ) MNG-5993 Confusing error message in case of missing/empty (khmarbaise: rev 49cf5d8fb6fb30142e6f91f9d17658e59c54b27f) (edit) maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java (edit) maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-artifactId-pluginManagement.xml (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-plugin-version-pluginManagement.xml (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-groupId-pluginManagement.xml (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-ga-pluginManagement.xml (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1393 (See https://builds.apache.org/job/maven-3.x/1393/)
          MNG-5993 Confusing error message in case of missing/empty (khmarbaise: rev 8fe10c34128ee1c8dfe00a1be3828931b14b6c5e)

          • (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1393 (See https://builds.apache.org/job/maven-3.x/1393/ ) MNG-5993 Confusing error message in case of missing/empty (khmarbaise: rev 8fe10c34128ee1c8dfe00a1be3828931b14b6c5e) (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1525 (See https://builds.apache.org/job/maven-3.x/1525/)
          MNG-5993 Confusing error message in case of missing/empty (khmarbaise: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=017dcaf22a2cc1c6361dc64a02d1bdbdb799b95e)

          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-artifactId-pluginManagement.xml
          • (edit) maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
          • (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
          • (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
          • (edit) maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-groupId-pluginManagement.xml
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-plugin-version-pluginManagement.xml
          • (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-ga-pluginManagement.xml
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1525 (See https://builds.apache.org/job/maven-3.x/1525/ ) MNG-5993 Confusing error message in case of missing/empty (khmarbaise: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=017dcaf22a2cc1c6361dc64a02d1bdbdb799b95e ) (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-artifactId-pluginManagement.xml (edit) maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java (edit) maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java (edit) maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-groupId-pluginManagement.xml (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-plugin-version-pluginManagement.xml (add) maven-model-builder/src/test/resources/poms/validation/raw-model/missing-ga-pluginManagement.xml

            People

            • Assignee:
              khmarbaise Karl Heinz Marbaise
              Reporter:
              kwin Konrad Windszus
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development