I am trying to use the maven plugin to generate the controllers and the models for my swagger definition. The models generate just fine, but I can't get the controller to be generated.
If I use the swagger-codegen-cli, the controller is generated. Here is the command line that I am using:
$ swagger-codegen generate -l inflector --output generated --input-spec ./src/main/swagger/swagger.yaml
Any idea as to why the controller is not generated from maven? What am I missing?
Here is the maven plugin configuration:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<id>generate-server</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<environmentVariables>
<!-- models to generate, empty means *all* -->
<!-- <models></models> -->
<!-- required by models as a helper -->
<supportingFiles>StringUtil.java</supportingFiles>
</environmentVariables>
<inputSpec>src/main/swagger/swagger.yaml</inputSpec>
<language>inflector</language>
<!-- <library>jersey2</library> -->
<!-- <configurationFile></configurationFile> -->
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<groupId>com.gotransverse.tract</groupId>
<artifactId>tract-customer-api</artifactId>
<artifactVersion>0.1</artifactVersion>
<sortParamsByRequiredFlag>true</sortParamsByRequiredFlag>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<!-- <sourceFolder>src/main/java</sourceFolder> -->
<!-- <sourceFolder>target/generated-sources</sourceFolder> -->
</configOptions>
<!--
<output>${project.build.directory}/generated-sources/swagger</output>
<modelPackage>com.gotransverse.tract.api.customer.model</modelPackage>
<controllerPackage>com.gotransverse.tract.api.customer.controller</controllerPackage>
<apiPackage>com.gotransverse.tract.api</apiPackage>
<invokerPackage>com.gotransverse.tract.api.util</invokerPackage>
-->
<!-- <addCompileSourceRoot>true</addCompileSourceRoot> -->
<!-- <templateDirectory></templateDirectory> -->
</configuration>
</execution>
</executions>
</plugin>
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eatbacon</groupId>
<artifactId>swaggerhub-client-sample</artifactId>
<packaging>jar</packaging>
<name>swaggerhub-client-sample</name>
<version>1.0.0-SNAPSHOT</version>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<!-- copy the swagger definition from swaggerhub -->
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>fetch-swagger</id>
<phase>generate-sources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://api.swaggerhub.com/apis/fehguy/swaggerhub-sample/1.0.0</url>
<outputFileName>swagger.json</outputFileName>
<outputDirectory>${project.build.directory}/conf</outputDirectory>
<skipCache>true</skipCache>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${codegen.version}</version>
<executions>
<execution>
<id>generate-server</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>target/conf/swagger.json</inputSpec>
<language>inflector</language>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<groupId>com.gotransverse.tract</groupId>
<artifactId>tract-customer-api</artifactId>
<artifactVersion>0.1</artifactVersion>
<sortParamsByRequiredFlag>true</sortParamsByRequiredFlag>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- inflector library -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-inflector</artifactId>
<version>${inflector.version}</version>
</dependency>
</dependencies>
<properties>
<codegen.version>2.1.5</codegen.version>
<inflector.version>1.0.2</inflector.version>
<junit.version>4.8.1</junit.version>
</properties>
</project>
On Jan 29, 2016, at 7:36 AM, Jeffrey Haynes <jeff9...@gmail.com> wrote:Duh. Wow, that was a dumb error. I specified the swagger-inflector version as the version for the swager-codegen-maven-plugin... I need more coffee... :-)