Skip to content

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

@mott-edict

Description

@mott-edict

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions