mvn 和 lombok 使用过程中,最终决定对 maven-source-plugin、maven-javadoc-plugin改造

org.apache.maven.plugin.javadoc.resolver.ResourceResolver

@SuppressWarnings( "unchecked" )
    private static List<String> resolveFromProject( final SourceResolverConfig config,
                                                    final MavenProject reactorProject, final Artifact artifact )
    {
        final List<String> dirs = new ArrayList<String>();

        if ( config.filter() == null || config.filter().include( artifact ) )
        {
            if ( config.includeCompileSources() )
            {
                final List<String> srcRoots = reactorProject.getCompileSourceRoots();
                for ( final String root : srcRoots )
                {
                    dirs.add( root );
                }
            }

            if ( config.includeTestSources() )
            {
                final List<String> srcRoots = reactorProject.getTestCompileSourceRoots();
                for ( final String root : srcRoots )
                {
                    dirs.add( root );
                }
            }
        }

        return JavadocUtil.pruneDirs( reactorProject, dirs );
    }


 @SuppressWarnings("unchecked")
    private static List<String> resolveFromProject(final SourceResolverConfig config,
                                                   final MavenProject reactorProject, final Artifact artifact) {

        final List<String> dirs = new ArrayList<String>();

        if (config.filter() == null || config.filter().include(artifact)) {
            if (config.includeCompileSources()) {

                List<String> compileSourceRoots = reactorProject.getCompileSourceRoots();

                List removeList = new ArrayList<>();

                String baseDir = reactorProject.getBasedir().toString();

                File delombokPath = new File(baseDir + File.separator
                        + "target" + File.separator + "delombok");

                if (delombokPath.exists()) {
                    compileSourceRoots.add(delombokPath.toString());

                    List<String> compileSourceRootsList = reactorProject.getCompileSourceRoots();

                    for (String s : compileSourceRootsList) {

                        if (s.endsWith("src" + File.separator + "main" + File.separator + "java")) {

                            removeList.add(s);
                        }
                    }

                    compileSourceRoots.removeAll(removeList);
                    dirs.addAll(compileSourceRoots);
                } else {
                    final List<String> srcRoots = reactorProject.getCompileSourceRoots();
                    for (final String root : srcRoots) {
                        dirs.add(root);
                    }
                }
            }

            if (config.includeTestSources()) {
                final List<String> srcRoots = reactorProject.getTestCompileSourceRoots();
                for (final String root : srcRoots) {
                    dirs.add(root);
                }
            }
        }

        return JavadocUtil.pruneDirs(reactorProject, dirs);
    }