You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (Jira)" <ji...@apache.org> on 2021/09/05 16:28:00 UTC

[jira] [Commented] (MCOMPILER-391) annotationProcessorPaths have to follow dependencyManagement rules

    [ https://issues.apache.org/jira/browse/MCOMPILER-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17410202#comment-17410202 ] 

Robert Scholte commented on MCOMPILER-391:
------------------------------------------

Fix should be something like this (using the dependency resolver of maven-artifact-transfer), but I'm getting an NPE
{code}
    private List<String> resolveProcessorPathEntries()
        throws MojoExecutionException
    {
        if ( annotationProcessorPaths == null || annotationProcessorPaths.isEmpty() )
        {
            return null;
        }

        try
        {
            Set<String> elements = new LinkedHashSet<>();
            
            ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
            
            final List<Dependency> managedDependencies;
            if ( project.getDependencyManagement()  == null )
            {
                managedDependencies = Collections.emptyList();
            }
            else
            {
                managedDependencies = project.getDependencyManagement().getDependencies();
            }
            
            Iterable<ArtifactResult> artifacts = dependencyResolver.resolveDependencies( buildingRequest,
                                                                                         annotationProcessorPaths,
                                                                                         managedDependencies,
                                                                                         null);

            for ( ArtifactResult artifactResult : artifacts )
            {
                elements.add( artifactResult.getArtifact().getFile().getAbsolutePath() );
            }
            
            return new ArrayList<>( elements );
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Resolution of annotationProcessorPath dependencies failed: "
                + e.getLocalizedMessage(), e );
        }
    }
{code}

> annotationProcessorPaths have to follow dependencyManagement rules
> ------------------------------------------------------------------
>
>                 Key: MCOMPILER-391
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-391
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.8.0
>            Reporter: Stanislav Spiridonov
>            Priority: Blocker
>         Attachments: MCOMPILER-391.zip
>
>
> # Use the version from dependency management
>  # Respect the exclude (blocker for me)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)