マルチモジュールのmavenプロジェクトがあります。親でPOMをビルドすると、すべての子モジュールがビルドされ、最後に実行可能なjarを準備する子モジュールがビルドされます。この最後のモジュールには、実行可能ファイルを実行する ant スクリプトが含まれており、親から実行すると機能しませんが、子の POM を分離して実行すると機能します。問題はMavenクラスパスの問題だと思います。
POM の antrun セクションは次のとおりです。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- Clean execution is here-->
<execution>
<id>compile</id>
<phase>package</phase>
<configuration>
<target>
<!-- I have tried commenting out the following 4 lines but this does not work.-->
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="runtime_classpath" refid="maven.runtime.classpath" />
<property name="test_classpath" refid="maven.test.classpath" />
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<property name="buildConfig" value="${buildConfig}" />
<property name="buildversion" value="${currentVersion}" />
<ant antfile="${basedir}/ANT FILE NAME.xml">
<target name="all" />
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Ant スクリプトには次の行が含まれています。
<target name="generate.scripts" depends="" description="generate scripts">
<mkdir dir="${distdir.product}" />
<mkdir dir="${distdir.product}/bin" />
<exec executable="bin/start.bat" dir="." failonerror="true">
<arg line="-server -createscript ${distdir.product}/bin/startserver.bat" />
</exec>
そして失敗します:
Cannot run program "bin\start.bat" (in directory "CORRECT_DIRECTORY"): CreateProcess error=2, The system cannot find the file specified
何か案は?