Exporting a package with no Java sources
Alexander Udalov
alexander.udalov at jetbrains.com
Fri Jun 30 16:41:32 UTC 2017
I'm trying to figure out how to compile a mixed-language (in this
case, Java + Kotlin) JVM module and having a problem in case the
module tries to export a package without any .java sources in it. The
javac error I get is:
src/module-info.java:2: error: package is empty or does not exist: foo
exports foo;
^
Now, through experiments, I found out that it's actually possible to
workaround this error by
1) always compiling non-.java sources first, and
2) compiling .java sources to the same directory where non-.java
sources are compiled to on step 1.
However, with Gradle deprecating single-output directory builds for
projects using multiple JVM languages [1], this workaround is not
always going to be possible.
Is there some other way to suggest to javac that .class files in a
particular location on the disk are a part of the same module, so that
it would be possible to export the package?
If there isn't, would it make sense to relax the severity of this
compiler message to a warning?
Thank you in advance!
Alexander
[1] https://docs.gradle.org/4.0/release-notes.html#multiple-class-directories-for-a-single-source-set
More information about the jigsaw-dev
mailing list