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

Plugin not compatible with java 17 #30

Closed fvanhovell-ing closed 1 year ago

fvanhovell-ing commented 1 year ago

Returns following error when run from maven invocation:

[ERROR] Failed to execute goal com.github.giuliopulina:swagger-validator-maven-plugin:1.0.0:validate (validate-contract) on project api-contracts: Execution validate-contract of goal com.github.giuliopulina:swagger-validator-maven-plugin:1.0.0:validate failed: java.lang.IllegalArgumentException: Unsupported class file major version 61 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.giuliopulina:swagger-validator-maven-plugin:1.0.0:validate (validate-contract) on project api-contracts: Execution validate-contract of goal com.github.giuliopulina:swagger-validator-maven-plugin:1.0.0:validate failed: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
...
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution validate-contract of goal com.github.giuliopulina:swagger-validator-maven-plugin:1.0.0:validate failed: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
...
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at com.github.sylvainlaurent.maven.swaggervalidator.instrumentation.Instrumentation.init (Instrumentation.java:38)
    at com.github.sylvainlaurent.maven.swaggervalidator.ValidateMojo.execute (ValidateMojo.java:53)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
...
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at net.bytebuddy.jar.asm.ClassReader.<init> (ClassReader.java:195)
giuliopulina commented 1 year ago

@fvanhovell-ing On this repo, only jdk8 can be used (and this project seems abandoned). I have created a fork some time ago that was already able to run with jdk11. To make it run with jdk17, it was just a matter of updating the byte-buddy dependency. I have already uploaded a new artifact to maven central (should be shortly available).

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

You can see here that CI runs with jdk17

fvanhovell-ing commented 1 year ago

Problem solved for JDK 17