前提
Javaで作成してるアプリが有り、Maven操作してます。
OpenAPIと言うソースの自動生成ツールを使い、生成した資材だけでJarに固め、
本資材のアプリのソースに組み込んで(Jarのimport)最終的なJARを作成したいと思ってます。
1.[A]openapi-generatorを使ってJavaソースを生成し、それだけでjarに固めたい。
2.[A]のjarを本資材に組込み、全体ビルドしたい。
実現したいこと
openapi-generator-maven-plugin
ここに実現したいことを箇条書きで書いてください。
- openapi-generatorで生成されたJavaソースだけをjarに固めたい。(本資材のビルドが走らぬ様)
発生している問題・エラーメッセージ
以下の①③のみですとビルドは正常に行われ、JARファイル(本資材のみ)も生成されます。
ただ、②を含めますとopenAPIのソースはtarget/generate-source/以下に生成されるのですが、全体Buildが同時に走ってしまう為か、本資材側のソースでエラーが起こります。
target/generate-source/以下だけを対象にMavenのビルドコマンドを作るにはどの様にすれば良いでしょうか?(goalが関係している?)
お分かりになる方いましたら宜しくお願いします。
該当のソースコード
pom.xml
1 <build> 2 <pluginManagement> 3 <plugins> 4 <plugin> 5 <groupId>org.openapitools</groupId> 6 <artifactId>openapi-generator-maven-plugin</artifactId> 7 <version>5.4.0</version> 8 <executions> 9 <execution> 10 <goals> 11 <goal>generate</goal> 12 </goals> 13 <configuration> 14 <inputSpec>${codegen.definition}</inputSpec> 15 <groupId>${codegen.git.groupId}</groupId> 16 <artifactId>${codegen.git.artifactId}</artifactId> 17 <artifactVersion>${codegen.git.artifactVersion}</artifactVersion> 18 <generatorName>spring</generatorName> 19 <apiPackage>${codegen.package.api}</apiPackage> 20 <modelPackage>${codegen.package.message}</modelPackage> 21 <addCompileSourceRoot>true</addCompileSourceRoot> 22 <configOptions> 23 <basePackage>${codegen.package.base}</basePackage> 24 <configPackage>${codegen.package.config}</configPackage> 25 <useTags>true</useTags> 26 <openApiNullable>false</openApiNullable> 27 <interfaceOnly>true</interfaceOnly> 28 </configOptions> 29 </configuration> 30 </execution> 31 </executions> 32 </plugin> 33 </plugins> 34 </pluginManagement> 35 36 <plugins> 37 <plugin> ① 38 <groupId>org.codehaus.mojo</groupId> 39 <artifactId>build-helper-maven-plugin</artifactId> 40 </plugin> 41 <plugin> ② 42 <groupId>org.openapitools</groupId> 43 <artifactId>openapi-generator-maven-plugin</artifactId> 44 </plugin> 45 <plugin> ③ 46 <groupId>org.apache.maven.plugins</groupId> 47 <artifactId>maven-surefire-plugin</artifactId> 48 <configuration> 49 <argLine>-Dfile.encoding=UTF-8</argLine> 50 <executable>${java.home}/bin/java</executable> 51 <arguments> 52 <argument>-jar</argument> 53 <argument>lib/swagger-source-converter.jar</argument> 54 <argument>-i</argument> 55 <argument>${project.build.directory}/generated-sources/openapi/src/main/java</argument> 56 <argument>-o</argument> 57 <argument>${project.build.directory}/messages/generated-sources</argument> 58 <argument>-ip</argument> 59 <argument>${codegen.package.api}</argument> 60 <argument>-op</argument> 61 <argument>${codegen.package.message}</argument> 62 </arguments> 63 </configuration> 64 </plugin> 65 </plugins> 66 </build>
試したこと
上記の設定で
・mvn package -e
・①③のみの挙動&生成物の確認
・①②③の挙動&生成物の確認
補足情報(FW/ツールのバージョンなど)
PCの環境設定もJava1.8にパスを通しています。

回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。