My application depends on a third-party ear (it deconstructs it, adds/modifies some items therein, and reconstructs it into a new ear). The third-party ear must be built using a third-party build script.
I am trying to learn the "maven-y" way to set this up. I expect I will need to get the third-party ear installed into my repository.
I want to create a pom.xml for the third-party ear which will build the third-party ear and install/deploy it. I have created a pom.xml which successfully calls out to the third-party build script (via maven-antrun-plugin) and creates the ear in exactly the place that a default maven ear project would.
My problem is that maven's install plugin fails because it can't find the archive (it expects whatever plugin does the packaging to have set an attribute on the artifact object, which maven-antrun-plugin doesn't do).
mvn package
works fine and generates the ear.
The exact error message when running mvn install
looks like this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-install) on project third_party_ear: The
packaging for this project did not assign a file to the build artifact -> [Help 1]
Is there a better way to go about this?
<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.thirdparty</groupId>
<artifactId>third_party_ear</artifactId>
<version>9.0</version>
<packaging>ear</packaging>
<name>third_party_ear</name>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-ear</id>
<phase>none</phase>
</execution>
<execution>
<id>default-generate-application-xml</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<subant target="build-ear" antfile="build.xml" buildpath="${project.basedir}"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>