MG>see below
________________________________ From: Debraj Manna <subharaj.ma...@gmail.com> Sent: Tuesday, June 13, 2017 8:34 AM To: Maven Users List Subject: Maven antrun failing in parallel builds but working fine in non-parallel builds I am having a maven multi module project. A simplified pom.xml (under full-build) looks like below:- <?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> MG>add (maven.compile,maven.runtime,maven.test,maven.plugin) classpaths to ant (compile,runtime,test,plugin) classpaths e.g. <configuration> <target> <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"/> <echo message="compile classpath: ${compile_classpath}"/> <echo message="runtime classpath: ${runtime_classpath}"/> <echo message="test classpath: ${test_classpath}"/> <echo message="plugin classpath: ${plugin_classpath}"/> <tasks> <!-- collector --> <copy file="../collector-framework/collector/target/collector-${project.version}.jar" tofile="./target/collector/collector-${project.version}.jar"/> </tasks> </target> <!-- add in end target --> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles></project> The simplified pom.xml inside main looks like below:- <?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> Whenever I try to execute the above project with mvn clean install -T 4 the collector-framework project gets skipped and the build fails with error 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 Everything works fine if I just do mvn clean install. I think this is happening because ant-run is running before the main module execution is finished. Can someone let me know how can I make ant-run wait till main module compilation is over in case of parallel builds? - Maven Version - 3.5.0