私はmavenマルチモジュールプロジェクトを持っています。簡略化pom.xml
(full-build
下)以下のようになります -maven並列ビルドの場合、最後にmaven ant-runプラグインを実行
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<groupId>com.eros</groupId>
<artifactId>full-build</artifactId>
<version>0.001-SNAPSHOT</version>
<name>full-build</name>
<profiles>
<profile>
<id>build-only</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>../../main</module>
</modules>
</profile>
<profile>
<id>copy-only</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<!-- collector -->
<copy file="../collector-framework/collector/target/collector-${project.version}.jar"
tofile="./target/collector/collector-${project.version}.jar"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
main
内部の簡略化pom.xml
は、以下のようになります -
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.eros</groupId>
<artifactId>main</artifactId>
<version>0.001-SNAPSHOT</version>
<packaging>pom</packaging>
<name>main</name>
<modules>
<module>collector-framework</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.8,)</version>
<message>*** This project requires JDK 1.8/J2SE 8 or later. ***</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
私はmvn clean install -T 4
コレクタ・フレームワークと上記のプロジェクトを実行しようとするときはいつでもプロジェクトがスキップされ、エラーが発生してビルドに失敗する
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (default) on project full-build: An Ant BuildException has occured: Warning: Could not find file /Users/tuk/code/github/eros/main/collector-framework/collector/target/collector-0.001-SNAPSHOT.jar to copy.
[ERROR] around Ant part ...<copy file="../collector-framework/collector/target/collector-0.001-SNAPSHOT.jar" tofile="./target/collector/collector-0.001-SNAPSHOT.jar"/>... @ 4:143 in /Users/tuk/code/github/eros/main/full-build/target/antrun/build-main.xml
E私がちょうどうまくいくと、非常にうまくいく。mvn clean install
。私はこれが起こっていると思うのは、実行が完了してからmain
モジュールの実行が終了する前です。誰かが私に教えてください。ant-run
は、並列ビルドの場合、メインモジュールのコンパイルが終わるまで待つことができますか?
- Mavenのバージョン - 3.5.0