openapi-tools / swagger-maven-plugin

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

Incompatibility with Maven 3.3.9 #41

Closed user667 closed 4 years ago

user667 commented 4 years ago

We are using this plugin to generate a Swagger definition file in one of our projects. Once we wanted to deploy our artifacts to Nexus we ran into an issue on Jenkins (Maven version 3.3.9): https://gist.github.com/user667/c750fad5eb40956713b2c6ec366e1026 This is due to an incompatiblilty of Maven 3.3.9 and the dependencies set in this plugin, namely org.apache.maven.plugin-tools:maven-plugin-annotations:3.5 and org.apache.maven:maven-plugin-api:3.6.0, org.apache.maven:maven-core:3.6.0 and org.apache.maven:maven-artifact:3.6.0. Using Maven version 3.5+ doesn't have the issue.

Is it safe to use the workaround mentioned below (i.e. downgroading version 3.2.5/3.4)? And/or is it necessary to use the latest maven versions as a dependency?

To Reproduce Use Maven (version 3.3.9) and deploy (mvn clean deploy) an artifact that uses this plugin.

Expected behavior maven-deploy-plugin:3.0.0-M1:deploy should be successful.

Additional context As a workaround, one can override the above dependencies:

<build>
    <pluginManagement>
        <plugins>
            <!-- See: https://github.com/openapi-tools/swagger-maven-plugin -->
            <plugin>
                <groupId>io.openapitools.swagger</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>2.1.1</version>
                <!-- We need to downgrade certain Maven dependencies of this plugin in order to have successful builds on Jenkins (deploy) -->
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-plugin-api</artifactId>
                        <version>3.2.5</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-core</artifactId>
                        <version>3.2.5</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-artifact</artifactId>
                        <version>3.2.5</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.plugin-tools</groupId>
                        <artifactId>maven-plugin-annotations</artifactId>
                        <version>3.4</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.5.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
langecode commented 4 years ago

Sorry, but haven't had the time to look into the before. Looks like your problem is that you are using a pretty old version of Maven? You do not have the options of upgrading your Maven version?

That being said I think your workaround should be safe. My guess is that should it fail it would fail completely being unable to render any OpenAPI document at all.