You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dario Luis Coneglian Oliveros <ol...@cpqd.com.br> on 2006/05/10 16:33:35 UTC

Re: [m2] weird behaviour when using assembly plugin in a multiproject [REOPEN]

Hi there,
When trying to add more modules to my example, I found a new issue that 
seems to be a bug.
It's very easy to reproduce it.

Let's assume two new modules ('D' and 'E') were added to project 'M' 
where 'E' depends on 'D' as follows:
+ M
   + A
   + B (depends on A) (uses assembly plugin by attaching 'attached' goal 
to 'package' phase)
   + C (depends on B)
   + D (depends on A)
   + E (depends on D)

When running 'mvn install' in the project 'M' for the first time, the 
buid process fails saying that one required artifact is missing (see 
error below). And it turns out to be D.jar.
/[INFO] [jar:jar]
[INFO] Building jar: /l/disk0/devel/assembly/B/target/B-1.1.jar
Downloading: 
http://localhost/repo/internal/com/mycompany/assembly/D/1.1/D-1.1.jar
[WARNING] Unable to get resource from repository central 
(http://repo1.maven.org/maven2)
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.mycompany.assembly:D:jar:1.1
  Try downloading the file manually from the project website.
  Then, install it using the command:
      mvn install:install-file -DgroupId=//com.mycompany.assembly// 
-DartifactId=D \
          -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file
  Path to dependency:
        1) //com.mycompany.assembly//:E:jar:1.1
        2) //com.mycompany.assembly//:D:jar:1.1
----------
1 required artifact is missing.
for artifact:
  //com.mycompany.assembly//:E:jar:1.1
from the specified remote repositories:
  central (http://repo1.maven.org/maven2)
/
It looks like the module B triggers the compilation of all modules and 
when it does that, it happens that E is being compiling but its 
dependency (D) is not in the local repository yet.
NOTE: Be sure to clean up the local repository before running 'mvn install'.

Should I file a JIRA issue ?
Please let me know any comments on this.
Thanks,
Dário

Dario Luis Coneglian Oliveros wrote:

> It worked like a charm.
> Thank you !
> Dário
>
> Edwin Punzalan wrote:
>
>>
>> When you want to put run assembly from inside the pom, use the goal 
>> "attached" instead of "assembly"
>>
>>
>> Dario Luis Coneglian Oliveros wrote:
>>
>>> Hi there,
>>> I've noticed a weird behaviour with the mave-assembly-plugin 
>>> (2.1-SNAPSHOT) and still not sure whether it's a bug.
>>> Suppose you have a multiproject M with three jar modules (A, B, C) 
>>> where B uses the maven-assembly-plugin by attaching 'assembly' goal 
>>> to the 'package' phase.
>>>
>>> + M
>>>    + A
>>>    + B (depends on A and uses assembly plugin)
>>>    + C (depends on B)
>>>
>>> pom.xml snippet of module B:
>>>    ...
>>> /    <build>
>>>        <plugins>
>>>            <plugin>
>>>                <artifactId>maven-assembly-plugin</artifactId>
>>>                <executions>
>>>                    <execution>
>>>                        <phase>package</phase>
>>>                        <goals>
>>>                           <goal>assembly</goal>
>>>                        </goals>
>>>                       <configuration>
>>>                           <descriptors>
>>>                               
>>> <descriptor>src/main/assembly/bin.xml</descriptor>
>>>                           </descriptors>
>>>                       </configuration>
>>>                    </execution>
>>>                </executions>
>>>            </plugin>
>>>        </plugins>
>>>    </build>
>>>    ...
>>> / bug]
>>> When running 'mvn package' in the parent project (M), the following 
>>> happens:
>>> 1) A.jar is built
>>> 2) B.jar is built and a message is printed saying that 
>>> 'assembly:assembly' was being prepared
>>> 3) A.jar is built again
>>> 4) B.jar is built again and a warning message is printed out: 
>>> "Removing: assembly from forked lifecycle, to prevent recursive 
>>> invocation"
>>> 5) C.jar is built for the first time
>>> 6) B-bin.tar.gz an B-bin.zip are generated
>>> 7) C.jar is built again
>>>
>>> It seems like B triggers the 'jar:jar' goal again for each module 
>>> before assemblying.
>>> Not sure whether it's a bug or something I am doing wrong.
>>> Any help will be appreciated.
>>>
>>> Thanks,
>>> Dário
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>