mojohaus / animal-sniffer

https://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/
MIT License
86 stars 44 forks source link

Unable to auto-detect boot classpath for JDK 9 #28

Open simontunnat opened 7 years ago

simontunnat commented 7 years ago

Creating a api signature for JDK 9 fails because the animal sniffer plugin can't detect the boot classpath for JDK 9.

I took the following steps:

1) I downloaded the JDK 9 from http://www.java.net/download/java/jdk9/archive/157/binaries/jdk-9-ea+157_linux-x64_bin.tar.gz to "/usr/lib/jvm/java-9-jdk".

2) I configured the following toolchain in the "~/.m2/toolchains.xml":

`

jdk
<provides>
  <version>1.9</version>
  <vendor>oracle</vendor>
</provides>
<configuration>
  <jdkHome>/usr/lib/jvm/java-9-jdk</jdkHome>
</configuration>

`

3) If configured the animal sniffer plugin as follows: `

org.codehaus.mojo
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-signature</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <includeModuleClasses>false</includeModuleClasses>
                            <includeJavaHome>true</includeJavaHome>
                            <jdk>
                                <version>1.9</version>
                            </jdk>
                        </configuration>
                    </execution>
                </executions>
            </plugin>`

4) After executing "mvn clean verify" I got the following error message:

[ERROR] Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:build (create-signature) on project jdk9-signature: Could not auto-detect java boot classpath for /usr/lib/jvm/java-9-jdk/bin/java -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:build (create-signature) on project jdk9-signature: Could not auto-detect java boot classpath for /usr/lib/jvm/java-9-jdk/bin/java at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoFailureException: Could not auto-detect java boot classpath for /usr/lib/jvm/java-9-jdk/bin/java at org.codehaus.mojo.animal_sniffer.maven.BuildSignaturesMojo.detectJavaClasspath(BuildSignaturesMojo.java:483) at org.codehaus.mojo.animal_sniffer.maven.BuildSignaturesMojo.detectJavaBootClasspath(BuildSignaturesMojo.java:447) at org.codehaus.mojo.animal_sniffer.maven.BuildSignaturesMojo.execute(BuildSignaturesMojo.java:340) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more

5) I could also recreate the error by executing:

/usr/lib/jvm/java-9-jdk/jre/bin/java -jar [...]/java-boot-classpath-detector-1.15.jar

Which fails withe the following error message:

Cannot auto-detect boot class path 9-ea [...]/java-boot-classpath-detector-1.15.jar

rfscholte commented 7 years ago

I would like to see signatures per module because you can't speak of THE runtime anymore. This would mean a new implementation for creating such signatures.