且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Maven项目迁移到模块-忽略module-info.java

更新时间:2022-06-12 22:59:11

仍然令人困惑的是,该过滤器不适用于module-info.java,但是从编译器插件的来源看,我想这就是这样的方式:

Still it's intersting that filter doesn't work for module-info.java, but looking the source of compiler plugin I guess that's just the way it is:

https://github.com/apache/maven-compiler-plugin/blob/master/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java >

    protected void preparePaths( Set<File> sourceFiles )
    {
        //assert compilePath != null;

        File moduleDescriptorPath = null;

        boolean hasModuleDescriptor = false;
        for ( File sourceFile : sourceFiles )
        {
            if ( "module-info.java".equals( sourceFile.getName() ) )
            {
                moduleDescriptorPath = sourceFile;
                hasModuleDescriptor = true;
                break;
            }
}