You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Samuli Saarinen (JIRA)" <ji...@codehaus.org> on 2011/04/12 12:51:22 UTC

[jira] Created: (MNG-5062) Dependency resolution in multimodule project with child having different groupId

Dependency resolution in multimodule project with child having different groupId
--------------------------------------------------------------------------------

                 Key: MNG-5062
                 URL: http://jira.codehaus.org/browse/MNG-5062
             Project: Maven 2 & 3
          Issue Type: Bug
    Affects Versions: 3.0.3
         Environment: java 1.6 maven 3.0.3 (3.0.2 also)
            Reporter: Samuli Saarinen
            Priority: Minor
         Attachments: maven-test.zip

I don't know if this is as user or maven error but I'll report it any way. 
Dependency resolution does not work correctly when child project references a dependency defined in parent's dependencyManagement if childs groupId is not same as parents.

parents depedencyManagement
{code:xml}
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>child</artifactId>
      <version>${project.version}</version>
    </dependency>
....
{code}

childs pom.xml
{code:xml}
...
<parent>
  <groupId>com.example.test</groupId>
  <artifactId>parent</artifactId>
  <version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.example.other</groupId>
<artifactId>child2</artifactId>
	
<dependencies>
  <dependency>
    <groupId>com.example.test</groupId>
    <artifactId>child</artifactId>
  </dependency>
</dependencies>			
{code}

It works if hard coded groupId instead of ${project.groupId} is used in the parent.

Attached is a sample project that demonstrates the problem.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-5062) Dependency resolution in multimodule project with child having different groupId

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-5062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann closed MNG-5062.
----------------------------------

    Resolution: Not A Bug
      Assignee: Benjamin Bentmann

Expressions referring to {{project.*}} are evaluated against the project that is to be built, not the POM that declared them originally. I.e. child2 inherits the dependency management from its parent but uses the groupId of child2 to evaluate the expressions, yielding effectively:
{code:xml}
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.example.other</groupId>
      <artifactId>child</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
{code}
.

> Dependency resolution in multimodule project with child having different groupId
> --------------------------------------------------------------------------------
>
>                 Key: MNG-5062
>                 URL: http://jira.codehaus.org/browse/MNG-5062
>             Project: Maven 2 & 3
>          Issue Type: Bug
>    Affects Versions: 3.0.3
>         Environment: java 1.6 maven 3.0.3 (3.0.2 also)
>            Reporter: Samuli Saarinen
>            Assignee: Benjamin Bentmann
>            Priority: Minor
>         Attachments: maven-test.zip
>
>
> I don't know if this is as user or maven error but I'll report it any way. 
> Dependency resolution does not work correctly when child project references a dependency defined in parent's dependencyManagement if childs groupId is not same as parents.
> parents depedencyManagement
> {code:xml}
> <dependencyManagement>
>   <dependencies>
>     <dependency>
>       <groupId>${project.groupId}</groupId>
>       <artifactId>child</artifactId>
>       <version>${project.version}</version>
>     </dependency>
> ....
> {code}
> childs pom.xml
> {code:xml}
> ...
> <parent>
>   <groupId>com.example.test</groupId>
>   <artifactId>parent</artifactId>
>   <version>1.0-SNAPSHOT</version>
> </parent>
> <groupId>com.example.other</groupId>
> <artifactId>child2</artifactId>
> 	
> <dependencies>
>   <dependency>
>     <groupId>com.example.test</groupId>
>     <artifactId>child</artifactId>
>   </dependency>
> </dependencies>			
> {code}
> It works if hard coded groupId instead of ${project.groupId} is used in the parent.
> Attached is a sample project that demonstrates the problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira