-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Multi-Release JAR Files #235
Comments
Jar tool validates that public API does not diverge between classes for different release versions and prints something like:
@Sineaggi, do you experience issues with invalid multi-release jars? Could you please elaborate on how these jars were created (manually, via gradle/maven/etc. plugin)? |
I'm using gradle to create the jars. tasks.jar {
from(compileJava9Java.flatMap { it.destinationDirectory }) {
into("META-INF/versions/9")
}
manifest {
attributes["Multi-Release"] = "true"
}
} I'm guessing Gradle doesn't use the jar tool to create jars. |
Ok so building a new tar task that calls the java jar tool does properly warn.
Maybe this is better suited to an issue upstream in Gradle. |
Was able to get a gradle task to validate the jar produced by gradle tasks.register<JavaExec>("validateJar") {
mainModule = "jdk.jartool/sun.tools.jar.Main"
val jarFile = tasks.jar.flatMap { it.archiveFile }
inputs.file(jarFile)
argumentProviders.plusAssign(CommandLineArgumentProvider {
listOf(
"--validate",
"--file",
jarFile.get().toString(),
)
})
} |
The jar tool is relatively slow and doesn't have enough options which is why almost every build tool uses something else. A jar is, after all, just a zip. They optimize for performance. |
I wonder if the speed of |
Don't think so. Checks are (generally) slow! |
I can't find any documentation, but it looks like |
It's probably fine to close this issue. |
Multi-release jars https://openjdk.org/jeps/238 should have identical api surfaces, but if we create an mr-jar with a new or altered function signature, that's not currently checked by the plugin.
The text was updated successfully, but these errors were encountered: