This is a design flaw with the 2.0.x (and for now, the 2.1.x/trunk)
Maven code. In a multimodule build, when child modules specify the
parent pom in their <parent/> section, it forces Maven to sort the
parent pom's build ahead of those children. Since you're binding the
assembly plugin to the parent pom and (I'm assuming) your child poms
declare this parent as a <parent />, the parent's build runs
first...including the execution of the assembly plugin. At this stage
of the build, the child modules' binary artifacts don't exist yet,
and any reference to them will cause the assembly plugin execution to
fail.
The best workaround I've found to date is to create another module
whose only responsibility is to create that assembly. Then, specify
your other modules as dependencies in this new assembly module, and
use a dependencySet. Unfortunately, it seems that child modules'
binaries are not available for typically structured builds, at least
for now.
HTH,
-john
On Aug 27, 2007, at 11:37 AM, kapilanand wrote:
I am facing the same problem.
I am using Maven 2.0.7 and assembly plugin 2.2-beta-1
Here are some more details of the same problem (multi-module project):
1) "mvn package" with assembly:attached bound to package phase fails
When assembly:attached is bound to package phase, it fails
outrightly. It
does not try to create packages and it fails to find the artifact
file for
the moduleSet included in the assembly descriptor.
2) If assembly is not bound to the package phase, it still fails
except in
one scenario:
- When I remove this execution binding, "mvn assembly:assembly"
fails with
the same error but only after going through the packaging of all
modules.
(Looks like package is a pre-requisite for assembly anyway)
- Running package and assembly:assembly is two steps also fails
with the
identical error.
mvn package
mvn assembly:assembly
- This runs successfully only if I use "mvn package
assembly:assembly", that
is when both package and assembly:assembly goals run in the same JVM.
Vanja Petreski wrote:
lib-release.xml:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>lib-release</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>${artifactId}</baseDirectory>
<moduleSets>
<moduleSet>
<includes>
<include>com.antegra.aims:aims-bot-api</include>
<include>com.antegra.aims:aims-bot-core</include>
</includes>
<binaries>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
<includeDependencies>false</includeDependencies>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
On 8/20/07, Vanja Petreski <[EMAIL PROTECTED]> wrote:
Hello,
I have problem with attached goal.
Parent POM:
<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/maven-v4_0_0.xsd
">
<modelVersion>4.0.0</modelVersion>
<groupId>com.antegra.aims</groupId>
<artifactId>aims-bot</artifactId>
<packaging>pom</packaging>
<version>0.1.0-alpha-SNAPSHOT</version>
<name>aims-bot</name>
<url>http://www.antegra.com</url>
<description>AIMS Bot Library</description>
<properties>
<aimsBotVersion>0.1.0-alpha-SNAPSHOT</aimsBotVersion>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorSourceDirectory>
src/main/assembly
</descriptorSourceDirectory>
</configuration>
<executions>
<execution>
<id>lib-release</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
<module>aims-bot-api</module>
<module>aims-bot-core</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.antegra.aims</groupId>
<artifactId>aims-bot-api</artifactId>
<version>${aimsBotVersion}</version>
</dependency>
<dependency>
<groupId>com.antegra.aims</groupId>
<artifactId>aims-bot-core</artifactId>
<version>${aimsBotVersion}</version>
</dependency>
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smack</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
-----------------------------------------------
When I fire mvn package, the following error occurs:
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] aims-bot
[INFO] aims-bot-api
[INFO] aims-bot-core
[INFO]
--------------------------------------------------------------------
--------
[INFO] Building aims-bot
[INFO] task-segment: [package]
[INFO]
--------------------------------------------------------------------
--------
[INFO] [site:attach-descriptor]
[INFO] [assembly:attached {execution: lib-release}]
[INFO]
--------------------------------------------------------------------
----
[ERROR] BUILD ERROR
[INFO]
--------------------------------------------------------------------
----
[INFO] Failed to create assembly: Artifact:
com.antegra.aims:aims-bot-api:jar:0.1.0-alpha-SNAPSHOT (included by
module) does not have an artifact with a file. Please ensure the
package
phase is run before the assembly is generated.
--------------------------------
If I dont bind attached goal to the package phase and fire mvn clean
package assembly:assembly, everything is ok.
What is the problem?
Thanx,
Vanja
--
View this message in context: http://www.nabble.com/Multi-module-
project-and-maven-assembly-plugin-tf4297489s177.html#a12351662
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john