sylvainlaurent / swagger-validator-maven-plugin

A maven plugin that validates swagger files in yaml and json formats
Apache License 2.0
11 stars 6 forks source link

Not compatible with Java 11? #24

Open ch-egli opened 5 years ago

ch-egli commented 5 years ago

I tried to use the plugin in a Java 11 environment and got a classloader error: is the plugin not compatible with Java 11?

Version: 1.2.6

Here is my configuration:

<plugin>
    <groupId>com.github.sylvainlaurent.maven</groupId>
    <artifactId>swagger-validator-maven-plugin</artifactId>
    <version>1.2.6</version>
    <executions>
        <execution>
            <id>validate-openapi-yaml</id>
            <phase>validate</phase>
            <goals>
                <goal>validate</goal>
            </goals>
            <configuration>
                <failOnErrors>true</failOnErrors>
                <includes>
                    <include>src/main/resources/static/api/*.yaml</include>
                </includes>
            </configuration>
        </execution>
    </executions>
</plugin>

See full stacktrace below...

[DEBUG] Configuring mojo com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate from plugin realm ClassRealm[plugin>com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd] [DEBUG] Configuring mojo 'com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate' with basic configurator --> [DEBUG] (f) basedir = C:\devsbb\workspaces\tms-topo\tms-topo-gleisnetz [DEBUG] (f) failOnErrors = true [DEBUG] (f) includes = [src/main/resources/static/api/*.yaml] [DEBUG] (f) project = MavenProject: ch.sbb.tms.topo:tms-topo-gleisnetz:0.27.11-SNAPSHOT @ C:\devsbb\workspaces\tms-topo\tms-topo-gleisnetz\pom.xml [DEBUG] (f) verbose = true [DEBUG] -- end configuration -- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 32.428 s [INFO] Finished at: 2019-06-28T15:21:05+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate (validate-openapi-yaml) on project tms-topo-gleisnetz: Execution validate-openapi-yaml of goal com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate failed: java.lang.IllegalArgumentException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate (validate-openapi-yaml) on project tms-topo-gleisnetz: Execution validate-openapi-yaml of goal com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate failed: java.lang.IllegalArgumentException at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) 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) at org.codehaus.classworlds.Launcher.main (Launcher.java:47) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution validate-openapi-yaml of goal com.github.sylvainlaurent.maven:swagger-validator-maven-plugin:1.2.6:validate failed: java.lang.IllegalArgumentException at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) 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) at org.codehaus.classworlds.Launcher.main (Launcher.java:47) Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException at com.github.sylvainlaurent.maven.swaggervalidator.instrumentation.Instrumentation.init (Instrumentation.java:37) at com.github.sylvainlaurent.maven.swaggervalidator.ValidateMojo.execute (ValidateMojo.java:56) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) 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) at org.codehaus.classworlds.Launcher.main (Launcher.java:47) Caused by: java.lang.IllegalArgumentException at net.bytebuddy.jar.asm.ClassReader. (ClassReader.java:160) at net.bytebuddy.jar.asm.ClassReader. (ClassReader.java:143) at net.bytebuddy.pool.TypePool$Default.parse (TypePool.java:1033) at net.bytebuddy.pool.TypePool$Default.doDescribe (TypePool.java:1019) at net.bytebuddy.pool.TypePool$AbstractBase.describe (TypePool.java:347) at net.bytebuddy.pool.TypePool$AbstractBase$Hierarchical.describe (TypePool.java:406) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$TokenizedGenericType.toErasure (TypePool.java:5963) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$GenericTypeToken$Resolution$Raw$RawAnnotatedType.of (TypePool.java:3627) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$GenericTypeToken$Resolution$Raw.resolveFieldType (TypePool.java:3519) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$LazyFieldDescription.getType (TypePool.java:6270) at net.bytebuddy.description.field.FieldDescription$AbstractBase.asToken (FieldDescription.java:143) at net.bytebuddy.description.field.FieldDescription$AbstractBase.asToken (FieldDescription.java:87) at net.bytebuddy.description.field.FieldList$AbstractBase.asTokenList (FieldList.java:47) at net.bytebuddy.dynamic.scaffold.InstrumentedType$Factory$Default$1.represent (InstrumentedType.java:222) at net.bytebuddy.ByteBuddy.rebase (ByteBuddy.java:799) at net.bytebuddy.ByteBuddy.rebase (ByteBuddy.java:784) at com.github.sylvainlaurent.maven.swaggervalidator.instrumentation.Instrumentation.init (Instrumentation.java:30) at com.github.sylvainlaurent.maven.swaggervalidator.ValidateMojo.execute (ValidateMojo.java:56) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) 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) at org.codehaus.classworlds.Launcher.main (Launcher.java:47)

giuliopulina commented 5 years ago

Hi @ch-egli, I confirm that the plugin is currently not working with Java 11.

ch-egli commented 5 years ago

Are there any plans to update it?

giuliopulina commented 5 years ago

Honestly I don't know what does it take to upgrade (hopefully keeping retrocompatibility) because I always worked with java up to version 8, I can't promise anything but maybe in the near future I will try to update

prasannjeet commented 3 years ago

Probably a stupid question since it has already been resolved, but even the latest version 1.2.6 in maven central doesn't seem to support Java 11. Any idea which version should I use to work with Java 11? Thanks!

giuliopulina commented 3 years ago

Hi @prasannjeet,

a year and an half ago, I fixed the issue and opened a PR but it was not reviewed in a reasonable time, so I created a release in my own fork:

<dependency>
    <groupId>com.github.giuliopulina</groupId>
    <artifactId>swagger-validator-maven-plugin</artifactId>
    <version>1.0.0</version>
</dependency>

If the maintainer is willing to review it, I can open the PR again (https://github.com/sylvainlaurent/swagger-validator-maven-plugin/pull/25) so the code can be integrated in this repository.

prasannjeet commented 3 years ago

Hello @giuliopulina, thanks a lot for your contribution. I'll prefer using your fork instead. Hoping that it gets merged soon! :)