You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hervé Boutemy (JIRA)" <ji...@apache.org> on 2016/02/04 08:31:40 UTC
[jira] [Updated] (MNG-4600) [regression] Optional flag from
dependency management applied to dependencies
[ https://issues.apache.org/jira/browse/MNG-4600?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hervé Boutemy updated MNG-4600:
-------------------------------
Description:
The situation is quite complex to explain. I've a parent pom that defines dependencies in depMgmt. There's two projects in the multimodule project, the second depending on the first.
Excerpt (parent/depMgmt):
{code:xml}<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
<optional>true</optional>{code}
First child (redefines scope only):
{code:xml}<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>{code}
Second child:
{code:xml}<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>m3pb</groupId>
<artifactId>subproject1</artifactId>
<version>${project.version}</version>
</dependency>{code}
When running with maven 2, it works. When ran with maven 3, it fails on the second project, with a NoClassDefFoundError on the logback jar.
I seem to understand this is actually a bug in maven 2: as the depMgmt defines optional=true, it shouldn't have been working in maven2 without redeclaring the dependency in the second project.
>From my understanding:
* With maven 2, the transivity is taken in account and gives logback through the subproject1 link (from the second)
* With maven 3, this just doesn't work and this is the correct behaviour.
Please excuse my basic analysis.
I'm attaching a test project to let see more precisely the problem.
If you need any help, please let me know.
Cheers
--
Baptiste
was:
The situation is quite complex to explain. I've a parent pom that defines dependencies in depMgmt. There's two projects in the multimodule project, the second depending on the first.
Excerpt (parent/depMgmt):
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
<optional>true</optional>
First child (redefines scope only):
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>
Second child:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>m3pb</groupId>
<artifactId>subproject1</artifactId>
<version>${project.version}</version>
</dependency>
When running with maven 2, it works. When ran with maven 3, it fails on the second project, with a NoClassDefFoundError on the logback jar.
I seem to understand this is actually a bug in maven 2: as the depMgmt defines optional=true, it shouldn't have been working in maven2 without redeclaring the dependency in the second project.
>From my understanding:
* With maven 2, the transivity is taken in account and gives logback through the subproject1 link (from the second)
* With maven 3, this just doesn't work and this is the correct behaviour.
Please excuse my basic analysis.
I'm attaching a test project to let see more precisely the problem.
If you need any help, please let me know.
Cheers
--
Baptiste
> [regression] Optional flag from dependency management applied to dependencies
> -----------------------------------------------------------------------------
>
> Key: MNG-4600
> URL: https://issues.apache.org/jira/browse/MNG-4600
> Project: Maven
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 3.0-alpha-7
> Environment: Apache Maven 3.0-alpha-7 (r921173; 2010-03-09 23:31:07+0100)
> Java version: 1.5.0_17
> Java home: c:\projet\MM\outils\jdk\1.5.0\jre
> Default locale: fr_FR, platform encoding: Cp1252
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
> Reporter: Baptiste MATHUS
> Assignee: Benjamin Bentmann
> Fix For: 3.0-beta-1
>
> Attachments: bug-maven.zip
>
>
> The situation is quite complex to explain. I've a parent pom that defines dependencies in depMgmt. There's two projects in the multimodule project, the second depending on the first.
> Excerpt (parent/depMgmt):
> {code:xml}<dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-classic</artifactId>
> <version>${logback.version}</version>
> <scope>runtime</scope>
> <optional>true</optional>{code}
> First child (redefines scope only):
> {code:xml}<dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-classic</artifactId>
> <scope>compile</scope>
> </dependency>{code}
> Second child:
> {code:xml}<dependency>
> <groupId>org.slf4j</groupId>
> <artifactId>slf4j-api</artifactId>
> </dependency>
> <dependency>
> <groupId>m3pb</groupId>
> <artifactId>subproject1</artifactId>
> <version>${project.version}</version>
> </dependency>{code}
> When running with maven 2, it works. When ran with maven 3, it fails on the second project, with a NoClassDefFoundError on the logback jar.
> I seem to understand this is actually a bug in maven 2: as the depMgmt defines optional=true, it shouldn't have been working in maven2 without redeclaring the dependency in the second project.
> From my understanding:
> * With maven 2, the transivity is taken in account and gives logback through the subproject1 link (from the second)
> * With maven 3, this just doesn't work and this is the correct behaviour.
> Please excuse my basic analysis.
> I'm attaching a test project to let see more precisely the problem.
> If you need any help, please let me know.
> Cheers
> --
> Baptiste
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)