Skip to content

Idea: Use --module-source-path and --module for javac/javadoc/etc. #128

Open
@tlinkowski

Description

@tlinkowski

Currently, we instrument javac and javadoc with --module-path and some other options, but we're not making use of --module-source-path. Such approach means that some references between module descriptors are not allowed although they should (compilation fails).

Example

module A {
  requires B;
}
module B {
  exports org.test.pkg to A;
}

Currently, Gradle will first try to compile B's module-info.java, but it will fail saying that it can't find module A.

With --module-source-path + --module (as suggested by @sormuras), we should be able to compile one module at a time (as we do now), but with the awareness of other modules before they're compiled.

Problems

  1. To use --module-source-path, projects need to be in a layout where project dir name = module name. There's a convention for such naming (again, by @sormuras), but it's not widely used yet. Hence, this plugin would need to work for any kind of layout.

    • Potential solution: add a build-wide task that would copy all the module-info.java files into e.g. build/modules (all compileJava and javadoc tasks would need to depend on such a task).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions