Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
3.0.5
-
None
-
None
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 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.0-SNAPSHOT: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