You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Donszelmann Mark <ma...@gmail.com> on 2009/12/08 16:53:41 UTC
Module Interdependencies and NAR
Hi
I have a problem I am trying to solve for the NAR (Native Archive) plugin.
http://duns.github.com/maven-nar-plugin/index.html
It involves a multi-module project, where P is the top-level project,
and A and B are the modules and B has a declared dependency on A.
If this is all Java then the reactor figures out the order P, A, B.
Is it correct that it compiles and tests fine without ever running into the install phase... That is, maven
probably sorts out that B is dependent on A, and thus in this multi-module project:
1. B does not download A,
2. B just refers to module A.
If that is the case I would like to build this into the NAR, arranging "include" and references to libraries
without installing the NAR of A into the local repository.
I figured out how to get all the projects in a multi-module project, and can calculate the path
to the include and libs of A, BUT it seems like maven still wants to download A before I can
do anything, so maybe my assumption was incorrect ?
Regards
Mark Donszelmann
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Module Interdependencies and NAR
Posted by Donszelmann Mark <ma...@gmail.com>.
Hi Benjamin,
On Dec 9, 2009, at 12:04 AM, Benjamin Bentmann wrote:
> Donszelmann Mark wrote:
>
>> Is it correct that it compiles and tests fine without ever running into the install phase... That is, maven probably sorts out that B is dependent on A, and thus in this multi-module project:
>> 1. B does not download A,
>> 2. B just refers to module A.
>
> In principle yes, during a reactor build inter-module dependencies are satisfied by the build output of the corresponding project, i.e. "target/some.jar" or "target/classes" (if existent) in case we have no JAR yet.
ok, so I want to do something similar for "include" directories and machine specific libraries both stored in A library under target created by the nar plugin.
>
>> I figured out how to get all the projects in a multi-module project, and can calculate the path to the include and libs of A, BUT it seems like maven still wants to download A before I can
>> do anything, so maybe my assumption was incorrect ?
>
> It's not clear to me what your plugin does, when it does with respect to the lifecycle and what the project setup looks like where you encounter problems.
the nar compiles and links c, c++ etc into libraries, and packs them in nar files (jars). These get attached to the main jar file and installed on the repository.
When downloaded by a dependent project they get unpacked in the local repository so that include files and libraries are available to the compiler.
For a multi-project not doing "install" I would need to search and find these libraries in the other modules. As they have not been packed, they are still in target.
>
> If your goals use @requiresDependencyResolution, this will by design trigger resolution before your goal is invoked. Maven 3 supports an alternative annotation @requiresDependencyCollection that allows to determine the set of dependency artifacts without resolving their files (MNG-4331), maybe that fits better your intentions.
>
Ok, so this is what I do not really understand. In Maven 2 the CompileMojo, which I assume has "@requiresDependencyResolution compile", knows not to download or search the local repo for
the A, as it is available in the multi-module project. Where in the code does it do this.
Thanks for your help so far.
Regards
Mark
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Module Interdependencies and NAR
Posted by Benjamin Bentmann <be...@udo.edu>.
Donszelmann Mark wrote:
> Is it correct that it compiles and tests fine without ever running into the install phase... That is, maven
> probably sorts out that B is dependent on A, and thus in this multi-module project:
>
> 1. B does not download A,
> 2. B just refers to module A.
In principle yes, during a reactor build inter-module dependencies are
satisfied by the build output of the corresponding project, i.e.
"target/some.jar" or "target/classes" (if existent) in case we have no
JAR yet.
> I figured out how to get all the projects in a multi-module project, and can calculate the path
> to the include and libs of A, BUT it seems like maven still wants to download A before I can
> do anything, so maybe my assumption was incorrect ?
It's not clear to me what your plugin does, when it does with respect to
the lifecycle and what the project setup looks like where you encounter
problems.
If your goals use @requiresDependencyResolution, this will by design
trigger resolution before your goal is invoked. Maven 3 supports an
alternative annotation @requiresDependencyCollection that allows to
determine the set of dependency artifacts without resolving their files
(MNG-4331), maybe that fits better your intentions.
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org