pom.xml
ファイルを直接変更して、Swagger Codegen を Eclipse プロジェクトに追加しました。
<plugin>
<!--
Plugin that provides API-first development using swagger-codegen to
generate Spring-MVC endpoint stubs at compile time from a swagger definition file
-->
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin.version}</version>
<executions>
<execution>
<id>generate-swagger-javaclient</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/resources/swagger/remote-api.json</inputSpec>
<language>java</language>
<apiPackage>com.myproj</apiPackage>
<modelPackage>com.myproj.model</modelPackage>
<generateSupportingFiles>true</generateSupportingFiles>
<generateApiTests>false</generateApiTests>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<library>resttemplate</library>
</configuration>
</execution>
</executions>
</plugin>
Maven update または Mavengenerate-sources
ターゲットを実行すると、Eclipse プロジェクトの/target/generated-sources/swagger/src
フォルダーに生成されたすべてのアーティファクトが取得されます。
ただし、Eclipse はそれらを認識しません。一般人のように Eclipse ビルド パスを手動で編集する必要がありますか、それとも Eclipse はこの新しいソース フォルダーを自動的に認識する必要がありますか?