openapi-tools / swagger-maven-plugin

Maven plugin to activate the Swagger Core library to generate OpenAPI documentation.
MIT License
72 stars 46 forks source link

swagger-maven-plugin in the version 2.1.1 is not working with swagger-core (swagger-jaxrs2) version 2.1.0 #43

Closed mott-edict closed 4 years ago

mott-edict commented 4 years ago

Describe the bug swagger-maven-plugin in the version 2.1.1 is not working with swagger-core (swagger-jaxrs2) version 2.1.0 If you try to pass the swagger-core (swagger-jaxrs2) version 2.1.0 to the plugin as described in 'To Reproduce', the plugin uses the new passed version but if you compile it with maven it fails with the following error

mvn clean compile
......
[ERROR] Failed to execute goal io.openapitools.swagger:swagger-maven-plugin:2.1.1:generate (default) on project XYZ: Execution default of goal io.openapitools.swagger:swagger-maven-plugin:2.1.1:generate failed: A required class was missing while executing io.openapitools.swagger:swagger-maven-plugin:2.1.1:generate: org/reflections/Configuration

You can fix this error adding two following additional libraries to the plugin configuration.

<dependency>
    <groupId>org.reflections</groupId>
    <artifactId>reflections</artifactId>
    <version>0.9.11</version>
    <exclusions>
        <exclusion>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.10.0.pr3</version>
</dependency>

To Reproduce Pass swagger-core in version 2.1.0 to the plugin configuration, for example like this

<plugin>
    <groupId>io.openapitools.swagger</groupId>
    <artifactId>swagger-maven-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <outputDirectory>${project.build.directory}/${project.artifactId}</outputDirectory>
        <outputFormats>JSON,YAML</outputFormats>
        <prettyPrint>true</prettyPrint>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-jaxrs2</artifactId>
                <version>2.1.0</version>
        </dependency>
    </dependencies>
</plugin>

Build your project with maven mvn clean compile.

Expected behavior It would be great if the new version could use swagger-core (swagger-jaxrs2) in version >=2.1.0

langecode commented 4 years ago

Thanks for reporting. I will look into this.

langecode commented 4 years ago

Solved with release 2.1.2

vthanikachalam commented 3 years ago

It does not generate the specification

LewandowskiAnthony commented 2 years ago

Not working

SzabolcsBeko commented 2 years ago

Same for me, the oas file does not generated.