You are right Brian. Maven by itself takes care of uninstalled reactor projects dependencies. But some of the plugins dont. Installing projects in the local repo will ensure that all plugins will resolve their dependency.

Hypothetically speaking, wont there be cases where installation / deployment (in the local/remote repo) of the parent project & its modules
depends on the successful compile, test, package of all the sub-modules?
ie a all or nothing senario - If Project A v1 and its modules must be installed only if all the modules compile, test & package correctly. If this was possible one could do a multi-module package first and then if that was successful do a multi-module install.

But I guess installing the plugins in the local repo before deploying it to the remote repo is mavens way of doing things. But there should be some consistency and guidelines. Either include reactor projects completely or exclude them completely. 'Convention over configuration'. This would ensure that there is only one way of doing things.

A penny for your thoughts :).

Kind Regards
Varghese C V


Brian E. Fox wrote:
In some cases, Maven will look in the reactor projects and find
artifacts that haven't been installed. In my opinion, it shouldn't do
this. Things should have to be located in the local repo to be shared
amongst projects. The dependency plugin specifically does not look in
the reactors (at least for copy/unpack) but someone recently wrote an
issue for this.
-----Original Message-----
From: Varghese C V [mailto:[EMAIL PROTECTED] Sent: Monday, May 21, 2007 8:26 AM
To: Maven Users List
Subject: Re: Issue with dependency plugin, unpack goal

Thank you, Maria for your reply.

I was just trying various variations of the dependency.
First I tried putting the version in the dependency-plugin configuration
and no dependency elements defined.
That didnt work. Specifying my-app:1.0-SNAPSHOT in dependency &
dependencyManagement elements did not work either.

I have noticed that it works when I do the 'mvn install'. It does not
work with I try with 'mvn package'. dependencies before the
dependency-plugin can find it.

Here is another issue report that seems to suggest the same. http://jira.codehaus.org/browse/MNG-740.

Lesson learnt : Only install and above life cycle phases works in
multi-module maven builds if you have inter-project dependencies.
I am not sure why though. Reactor artifacts are not 'seen' by other
artifacts during a multi-module package. Install works cause the
artifacts are now in the local repository.

What do you think?

regards
Varghese



Maria Odea Ching wrote:
Hi,

I think what you have here is just a configuration problem.

The <dependencyManagement> that you have in your my-dep-app module should be on the parent pom, not in the my-dep-app pom.
That's why the dependency's version here --> [INFO] Configured
Artifact: com.mycomp.app:my-app:?:jar cannot be resolved, no version can be found on the parent pom when it looked there.

-Deng

Varghese C V wrote:
(Sorry, my earlier mail had a Re: in the subject by mistake, hence 'am reposting the issue with the correct subject title.)

I have a parent project which has two modules 'my-app' and 'my-dep-app' (both created by the archetype-create example). The 'my-dep-app' project wants the 'my-app' dependency to be unpacked into its target\classes folder. I am trying to merge the classes of multiple model projects before I can run the jibx xml binding compiler on them.

This way I need only one jibx binding factory for a group of related models. The error 'Failed to resolve artifact' and the fact that it works when installed in the local repository suggests that reactor artifacts are not checked to resolve the dependency. Is this a multi-module problem?

I would like to point out that looks very similar to a resolved dependency plugin issue (http://jira.codehaus.org/browse/MDEP-44),
except that I dont use the assembly plugin as shown in the test case.

Any help is appreciated.

Maven : 2.0.6
Maven dependency plugin : 2.0 alpha 4

This is the output I get. PFA the poms(Zip attachments are getting
rejected)

*********************************************************************
************


[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   my-app
[INFO]   my-dep-app
[INFO]   My-apps parent pom

[INFO]
---------------------------------------------------------------------
-------


[INFO] Building my-app
[INFO]    task-segment: [package]

[INFO]
---------------------------------------------------------------------
-------


...
[INFO] [jar:jar]

[INFO] Building jar: C:\test\mvn\dependency-unpack-test\my-app\target\my-app-1.0-SNAPSHOT.
jar
[INFO]
---------------------------------------------------------------------
-------


[INFO] Building my-dep-app
[INFO]    task-segment: [package]

[INFO]
---------------------------------------------------------------------
-------


[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [dependency:unpack {execution: default}] [INFO] Configured Artifact: com.mycomp.app:my-app:?:jar

[INFO]
---------------------------------------------------------------------
---

[ERROR] BUILD ERROR

[INFO]
---------------------------------------------------------------------
---

[INFO] Failed to resolve artifact.

GroupId: com.mycomp.app
ArtifactId: my-app
Version: 1.0-SNAPSHOT

Reason: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
 mvn install:install-file -DgroupId=com.mycomp.app
-DartifactId=my-app \
     -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file


com.mycomp.app:my-app:jar:1.0-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2)



[INFO]
---------------------------------------------------------------------
---

[INFO] For more information, run Maven with the -e switch

[INFO]
---------------------------------------------------------------------
---

[INFO] Total time: 4 seconds
[INFO] Finished at: Fri May 18 15:32:07 GST 2007 [INFO] Final Memory:

7M/13M

[INFO]
---------------------------------------------------------------------
---
*********************************************************************
************

---------------------------------------------------------------------
---

<project>
  <groupId>com.zafinlabs.project.miRevenue.hdfc.impl</groupId>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>myApps</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>My-apps parent pom</name>
  <modules>
    <module>my-app</module>
    <module>my-dep-app</module>
  </modules>
</project>
---------------------------------------------------------------------
---

<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.mycomp.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-app</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
---------------------------------------------------------------------
---

<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.mycomp.app</groupId>
  <artifactId>my-dep-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-dep-app</name>
  <url>http://maven.apache.org</url>
  <dependencyManagement>
    <dependencies>
        <dependency>
          <groupId>com.mycomp.app</groupId>
          <artifactId>my-app</artifactId>
          <version>${project.version}</version>
        </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.mycomp.app</groupId>
      <artifactId>my-app</artifactId>
    </dependency>
  </dependencies>
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.mycomp.app</groupId>
                                    <artifactId>my-app</artifactId>
<outputDirectory>target/classes</outputDirectory>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
  </build>
</project>

---------------------------------------------------------------------
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to