swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.98k stars 6.03k forks source link

[MAVEN] swagger-codegen-maven-plugin:2.2.3 generate goal execution fails #6590

Open aditya-chaturvedi opened 7 years ago

aditya-chaturvedi commented 7 years ago
Description

I upgraded plugin from v2.2.2 to v2.2.3 to specifically test the allOf and anyOf handling functionality, but generate goal just doesn't work anymore.

Swagger-codegen version

swagger-codegen-maven-plugin version - v2.2.3

Swagger declaration file content or url

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen-maven-plugin/examples/swagger.yaml

Command line used for generation

mvn io.swagger:swagger-codegen-maven-plugin:2.2.3:generate

Steps to reproduce
  1. please install maven3.3.3 on your workspace (or, use maven 3.3.x wrapper in your project)

  2. Please create a maven project with following plugin configuration for swagger-codegen-maven-plugin -

    <project>
    ...
    <build>
               <plugin>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.2.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>swagger.yaml</inputSpec>
                            <output>${project.build.directory}/generated-sources</output>
                            <language>java</language>
                            <configOptions>
                                <dateLibrary>java8</dateLibrary>
                            </configOptions>
                            <environmentVariables>
                                <models/>
                            </environmentVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    </build>
    </project>
  3. download the swagger.yaml from github url provided in previous section and save it right next to pom.xml.

  4. Run - mvn io.swagger:swagger-codegen-maven-plugin:2.2.3:generate

Related issues/PRs

This is the closest I came to finding something on this - https://github.com/swagger-api/swagger-codegen/issues/6362

Suggest a fix/enhancement

I tried going through the changes between 2.2.2 and 2.2.3, but too many changes to figure maven-plugin related changes - https://github.com/swagger-api/swagger-codegen/compare/v2.2.2...v2.2.3

wing328 commented 7 years ago

@aditya-chaturvedi thanks for reporting the issue. Can you try the latest master to see if it's still an issue? SNAPSHOT version available at https://github.com/swagger-api/swagger-codegen#compatibility

hieuletrung commented 6 years ago

I'm using v2.3.1 and still encounter the issue.

brenosilver commented 5 years ago

Any news on this? when trying to use the generate goal in my eclipse project, the IDE shows an error on the pom file. The sources are generated just fine , but I cant let my team use this plugin if it leaves an error in the project. Maven 3.5.3 swagger-codegen-maven-plugin 3.0.11