Java 使用swagger codegen插件通过几个yaml文件生成代码
我有几个swagger yaml文件,我想在编译时使用maven生成代码 这是我的密码:Java 使用swagger codegen插件通过几个yaml文件生成代码,java,maven,swagger-codegen,Java,Maven,Swagger Codegen,我有几个swagger yaml文件,我想在编译时使用maven生成代码 这是我的密码: <plugins> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.3.1&
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/*.yaml</inputSpec>
<language>java</language>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
有什么想法吗?我的问题通过多次执行得到解决,如下所示:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.5</version>
<executions>
<execution>
<id>a</id> .....
</execution>
<execution>
<id>b</id> .....
</execution>
<execution>
<id>c</id> .....
</execution>
</executions>
</plugin>
昂首阔步
swagger codegen maven插件
2.4.5
A.
B
C
i我非常确定swagger不允许为inputSpec使用通配符
您必须一次指定一个文件。但是每个yaml文件都会生成相同的组件类,如果它们在所有swagger中都很常见,那么您就有很多相同的类,但在不同的包中。。你面对过吗?是的,当然!但还是在不同的包装中,所以没关系!
failed to read resource listing
java.io.FileNotFoundException: C:\Projets\www\codegen\src\main\resources\*.yaml (La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte)
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.5</version>
<executions>
<execution>
<id>a</id> .....
</execution>
<execution>
<id>b</id> .....
</execution>
<execution>
<id>c</id> .....
</execution>
</executions>
</plugin>