[ https://jira.codehaus.org/browse/MNG-5634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Koppen updated MNG-5634: ---------------------------------- Description: The import scope does not work as expected when used in a scenario with inheritance and profiles. Please have a look at the attached testcase to understand the problem. We have a project POM that declares a dependency. The scope of this dependency ('runtime') is imported from a BOM POM ('runtime-bom'). The project POM has a parent POM which defines two profiles. In the first profile ('direct'), the scope of the dependency is set to 'provided'. In the second profile ('bom'), another BOM POM ('provided-pom') is imported that defines the scope of the dependency as 'provided'. When maven is executed without defining profiles, the dependency is resolved in scope 'runtime'. This is what I expect. When maven is executed with profile 'direct', the dependency is resolved in scope 'provided'. This is what I expect. When maven is executed with profile 'bom', the dependency is resolved in scope 'runtime'. I expect the scope to be 'provided'. The documentation ( http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html ) states that a dependency with scope 'import' is *replaced* by the dependencyManagement-block of the imported POM. This is not true in this case. Output from the command line: {{ import-scope-in-profile\project>mvn -Pdirect dependency:tree [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT [INFO] \- org.apache.maven.issues:dependency:jar:1.0SNAPSHOT:provided import-scope-in-profile\project>mvn -Pbom dependency:tree [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT [INFO] \- org.apache.maven.issues:dependency:jar:1.0-SNAPSHOT:runtime }} was: The import scope does not work as expected when used in a scenario with inheritance and profiles. Please have a look at the attached testcase to understand the problem. We have a project POM that declares a dependency. The scope of this dependency ('runtime') is imported from a BOM POM ('runtime-bom'). The project POM has a parent POM which defines two profiles. In the first profile ('direct'), the scope of the dependency is set to 'provided'. In the second profile ('bom'), another BOM POM ('provided-pom') is imported that defines the scope of the dependency as 'provided'. When maven is executed without defining profiles, the dependency is resolved in scope 'runtime'. This is what I expect. When maven is executed with profile 'direct', the dependency is resolved in scope 'provided'. This is what I expect. When maven is executed with profile 'bom', the dependency is resolved in scope 'runtime'. I expect the scope to be 'provided'. The documentation ( http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html ) states that a dependency with scope 'import' is *replaced* by the dependencyManagement-block of the imported POM. This is not true in this case. Output from the command line: import-scope-in-profile\project>mvn -Pdirect dependency:tree [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT [INFO] \- org.apache.maven.issues:dependency:jar:1.0SNAPSHOT:provided import-scope-in-profile\project>mvn -Pbom dependency:tree [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT [INFO] \- org.apache.maven.issues:dependency:jar:1.0-SNAPSHOT:runtime > Import scope is not respected in profiles > ----------------------------------------- > > Key: MNG-5634 > URL: https://jira.codehaus.org/browse/MNG-5634 > Project: Maven 2 & 3 > Issue Type: Bug > Components: Dependencies, Inheritance and Interpolation > Affects Versions: 3.0.5 > Reporter: Christian Koppen > Attachments: import-scope-in-profile.zip > > > The import scope does not work as expected when used in a scenario with > inheritance and profiles. > Please have a look at the attached testcase to understand the problem. > We have a project POM that declares a dependency. The scope of this > dependency ('runtime') is imported from a BOM POM ('runtime-bom'). The > project POM has a parent POM which defines two profiles. In the first profile > ('direct'), the scope of the dependency is set to 'provided'. In the second > profile ('bom'), another BOM POM ('provided-pom') is imported that defines > the scope of the dependency as 'provided'. > When maven is executed without defining profiles, the dependency is resolved > in scope 'runtime'. This is what I expect. > When maven is executed with profile 'direct', the dependency is resolved in > scope 'provided'. This is what I expect. > When maven is executed with profile 'bom', the dependency is resolved in > scope 'runtime'. I expect the scope to be 'provided'. > The documentation ( > http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html > ) states that a dependency with scope 'import' is *replaced* by the > dependencyManagement-block of the imported POM. This is not true in this case. > Output from the command line: > {{ > import-scope-in-profile\project>mvn -Pdirect dependency:tree > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- > [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT > [INFO] \- org.apache.maven.issues:dependency:jar:1.0SNAPSHOT:provided > import-scope-in-profile\project>mvn -Pbom dependency:tree > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ project --- > [INFO] org.apache.maven.issues:project:jar:1.0-SNAPSHOT > [INFO] \- org.apache.maven.issues:dependency:jar:1.0-SNAPSHOT:runtime > }} -- This message was sent by Atlassian JIRA (v6.1.6#6162)