[ 
http://jira.codehaus.org/browse/MNG-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Bentmann closed MNG-4930.
----------------------------------

    Resolution: Duplicate
      Assignee: Benjamin Bentmann

> List of active profiles defined in ~/.m2/settings.xml gets lost when parsing 
> dependency POMs
> --------------------------------------------------------------------------------------------
>
>                 Key: MNG-4930
>                 URL: http://jira.codehaus.org/browse/MNG-4930
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Dependencies, Profiles, Reactor and workspace, Settings
>    Affects Versions: 2.2.1, 3.0, 3.0.1, 3.0.2
>         Environment: Windows, Mac OS X, quite possibly all others
>            Reporter: Tibor Varga
>            Assignee: Benjamin Bentmann
>         Attachments: maven-bug.patch, root.zip, settings.xml
>
>
> Scenario:
> * {{root}} project with two sub projects, {{test-api}} and {{test-impl}}
> * {{~/.m2/settings.xml}} defines a property in a profile, {{xxx}}.
> * {{root/pom.xml}} defines a property, {{yyy}}, and a profile that defines 
> another property, {{zzz}}.
> * {{test-impl}} depends on {{test-api}}
> * {{test-api}} declares a dependency that uses {{xxx}} as the {{groupId}}, 
> {{yyy}} as the {{artifactId}} and {{zzz}} as the {{type}}.
> * Compile the {{root}} project with Maven ({{mvn compile}}), making sure the 
> profiles are active, one way or another.
> When {{test-api}} is compiled, all goes well. When {{test-impl}} is compiled, 
> Maven warns of the following:
> {noformat}
> [WARNING] The POM for test:test-api:jar:1.0-SNAPSHOT is invalid, transitive 
> dependencies (if any) will not be available,
> enable debug logging for more details
> {noformat}
> Turning on debuggig ({{mvn -X compile}}) prints:
> {noformat}
> [WARNING] The POM for test:test-api:jar:1.0-SNAPSHOT is invalid, transitive 
> dependencies (if any) will not be available:
> 1 problem was encountered while building the effective model for 
> test:test-api:1.0-SNAPSHOT
> [ERROR] 'dependencies.dependency.groupId' for ${xxx}:junit:jar with value 
> '${xxx}' does not match a valid id pattern. @ 
> {noformat}
> Apparently, property interpolation failed for {{xxx}} but not for {{yyy}} or 
> {{zzz}}, and {{xxx}} fails only when it is referenced in a _dependency_ of 
> the current project. When it is referenced in the current project, it gets 
> properly interpolated.
> What actually happens is that the list of active profiles defined outside the 
> reactor gets lost when resolving dependencies of the current project. They 
> are available when the current project's POM is parsed but not when parsing 
> the POM of the current project's dependencies.
> Now, although this is just a warning in my sample scenario, the consequences 
> in real life are more serious: "no transitive dependencies" means, e.g., 
> modules not compiling that should, or JAR artifacts missing from a WAR 
> artifact, etc., unless the user manually duplicates all the transitive 
> dependencies missed by Maven, in the project that did not compile, or missed 
> a few JAR files from its WAR artifact.
> Attached is a sample multi-module project as described above, a 
> {{settings.xml}} file required for the project to compile and a patch that 
> shows how the problem _could_ be eliminated on the maven-3 trunk 
> ({{http://svn.apache.org/repos/asf/maven/maven-3/trunk}}).
> The attached sample will give no warning prior to Maven 3.0 but if 
> {{test-impl}} were to actually require {{test-api}}'s dependencies to 
> compile, the problem would surface also with Maven 2.2.1 and possibly earlier.
> I don't think the attached patch is an elegant solution but it has the 
> quality of touching very few files and having little or no side effect other 
> than fixing the problem outlined above. In short, please, make a better fix.

-- 
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

        

Reply via email to