Skip to content

PluginDescriptor.getArtifacts() returns Artifact instances with null scope #12497

Closed

Description

@maroschutte

Affected version

3.10.0-rc-1

Bug description

When testing maven 3.10.0-rc-1 I found that the org.codehaus.mojo:jaxws-maven-plugin didn't work any longer.

Debugging this problem, I found that the org.apache.maven.plugin.descriptor.PluginDescriptor.getArtifacts() method now returns org.apache.maven.artifact.Artifact instances that return 'null' on their getScope() method. In maven 3.9.16 (and all versions before) the actual scope was returned (for instance "compile" or "runtime").

As far as I can tell this is a bug/regression on maven 3.10 which is possibly introduced by the introduction of resolver version 2

Activity

  1. added this to the 3.10.0 milestone on Jul 16, 2026
  2. slawekjaranowski commented on Jul 16, 2026

    @slawekjaranowski
    Member

    @maroschutte can you provide a simple project to reproduce issue?

  3. slawekjaranowski commented on Jul 16, 2026

    @slawekjaranowski
    Member

    Change introduced in

    In class maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java

    In 3.9.x we created list of plugin artifacts based on DependencyNode,

    now we use DependencyResult#getArtifactResults and convert to Maven artifacts by org.apache.maven.RepositoryUtils#toArtifact(org.eclipse.aether.artifact.Artifact), so scope is lost ....

  4. slawekjaranowski commented on Jul 16, 2026

    @slawekjaranowski
    Member

    I see https://github.com/mojohaus/jaxws-maven-plugin/blob/e2535600a431a832b71e047755abfb35d66c3d5a/src/main/java/org/codehaus/mojo/jaxws/AbstractJaxwsMojo.java#L547

          for ( Artifact a : pluginDescriptor.getArtifacts() )
          {
                addArtifactToCp( a, artifactsMap, endorsedArtifacts );
          }
    
    ...
    
        private void addArtifactToCp( Artifact a, Map<String, Artifact> artifactsMap, Set<Artifact> endorsedArtifacts )
        {
     ...
            else if ( "compile".equals( a.getScope() ) || "runtime".equals( a.getScope() ) )
            {
                artifactsMap.put( a.getGroupId() + ":" + a.getArtifactId(), a );
            }
        }

    so plugin dependencies with scope null is not added to ws class path

  5. maroschutte commented on Jul 17, 2026

    @maroschutte
    Author

    maven-12497.zip

    This is a simple project that compiles fine with 3.9.16 and fails with 3.10.0-rc-1

  6. added 3 commits that reference this issue on Jul 18, 2026
    4ae9f94
    e2b4130
    5ca34f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions