Search in sources :

Example 1 with JavaModuleDescriptor

use of com.thoughtworks.qdox.model.JavaModuleDescriptor in project maven-plugins by apache.

the class QDoxModuleInfoParser method getModuleDescriptor.

@Override
public org.apache.maven.plugin.compiler.module.JavaModuleDescriptor getModuleDescriptor(File modulePath) throws IOException {
    File moduleDescriptor = new File(modulePath, "module-info.java");
    org.apache.maven.plugin.compiler.module.JavaModuleDescriptor.Builder builder;
    if (moduleDescriptor.exists()) {
        JavaModuleDescriptor descriptor = new JavaProjectBuilder().addSourceFolder(modulePath).getDescriptor();
        builder = org.apache.maven.plugin.compiler.module.JavaModuleDescriptor.newModule(descriptor.getName());
        for (JavaModuleDescriptor.JavaRequires requires : descriptor.getRequires()) {
            builder.requires(requires.getModule().getName());
        }
        for (JavaModuleDescriptor.JavaExports exports : descriptor.getExports()) {
            builder.exports(exports.getSource().getName());
        }
    } else {
        builder = org.apache.maven.plugin.compiler.module.JavaModuleDescriptor.newAutomaticModule(null);
    }
    return builder.build();
}
Also used : JavaModuleDescriptor(com.thoughtworks.qdox.model.JavaModuleDescriptor) JavaProjectBuilder(com.thoughtworks.qdox.JavaProjectBuilder) File(java.io.File)

Aggregations

JavaProjectBuilder (com.thoughtworks.qdox.JavaProjectBuilder)1 JavaModuleDescriptor (com.thoughtworks.qdox.model.JavaModuleDescriptor)1 File (java.io.File)1