[jira] [Updated] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts

2018-05-22 Thread Ahmed Hammad (JIRA)

 [ 
https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ahmed Hammad updated MDEP-609:
--
Description: 
The issue might be related to MNG-6415

If a certain package is defined in 2 different artifacts, and a a maven module 
declares a dependency on these 2 artifacts (once through a transitive 
dependency and once using a declared dependency), dependency analyzer reports 
the dependency as "Used Undeclared", while declared dependencies should always 
take precedence (even if they appear later in the POM)

For example:

Project 1 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0
   test
project1
1.0.0-SNAPSHOT
   
  
 test
 project2
 1.0.0-SNAPSHOT
  
  
 org.hamcrest
 hamcrest-all
 1.1
  
   

{code}
Project 2 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
   4.0.0
test
project2
1.0.0-SNAPSHOT


org.hamcrest
hamcrest-core
1.3



{code}
And Project 1 uses a package which can be found in both hamcrest-core and 
hamcrest-all:
{code:java}
import org.hamcrest.core.IsEqual;

class Test {
IsEqual isEqual;
}
{code}
When doing a dependency analysis for Project 1, no "Used undeclared" are 
expected to be seen, because Project 1 declares a dependency on hamcrest-all.

However, I get:

[INFO] — maven-dependency-plugin:2.8:analyze (default-cli) @ project1 —
 [WARNING] Used undeclared dependencies found:
 [WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile

  was:
If a certain package is defined in 2 different artifacts, and a a maven module 
declares a dependency on these 2 artifacts (once through a transitive 
dependency and once using a declared dependency), dependency analyzer reports 
the dependency as "Used Undeclared", while declared dependencies should always 
take precedence (even if they appear later in the POM)

For example:

Project 1 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0
   test
project1
1.0.0-SNAPSHOT
   
  
 test
 project2
 1.0.0-SNAPSHOT
  
  
 org.hamcrest
 hamcrest-all
 1.1
  
   

{code}
Project 2 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
   4.0.0
test
project2
1.0.0-SNAPSHOT


org.hamcrest
hamcrest-core
1.3



{code}
And Project 1 uses a package which can be found in both hamcrest-core and 
hamcrest-all:
{code:java}
import org.hamcrest.core.IsEqual;

class Test {
IsEqual isEqual;
}
{code}
When doing a dependency analysis for Project 1, no "Used undeclared" are 
expected to be seen, because Project 1 declares a dependency on hamcrest-all.

However, I get:

[INFO] — maven-dependency-plugin:2.8:analyze (default-cli) @ project1 —
 [WARNING] Used undeclared dependencies found:
 [WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile


> Dependency analyzer gets confused if the same package is defined in 2 
> different artifacts
> -
>
> Key: MDEP-609
> URL: https://issues.apache.org/jira/browse/MDEP-609
> Project: Maven Dependency Plugin
>  Issue Type: Bug
>  Components: analyze
>Affects Versions: 3.1.0
>Reporter: Ahmed Hammad
>Priority: Major
>
> The issue might be related to MNG-6415
> If a certain package is defined in 2 different artifacts, and a a maven 
> module declares a dependency on these 2 artifacts (once through a transitive 
> dependency and once using a declared dependency), dependency analyzer reports 
> the dependency as "Used Undeclared", while declared dependencies should 
> always take precedence (even if they appear later in the POM)
> For example:
> Project 1 pom:
> {code:java}
> 
> http://maven.apache.org/POM/4.0.0;
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd;>
> 4.0.0
>test
> project1
> 1.0.0-SNAPSHOT
>
>   
>  test
>  

[jira] [Updated] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts

2018-04-26 Thread Ahmed Hammad (JIRA)

 [ 
https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ahmed Hammad updated MDEP-609:
--
Description: 
If a certain package is defined in 2 different artifacts, and a a maven module 
declares a dependency on these 2 artifacts (once through a transitive 
dependency and once using a declared dependency), dependency analyzer reports 
the dependency as "Used Undeclared", while declared dependencies should always 
take precedence (even if they appear later in the POM)

For example:

Project 1 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0
   test
project1
1.0.0-SNAPSHOT
   
  
 test
 project2
 1.0.0-SNAPSHOT
  
  
 org.hamcrest
 hamcrest-all
 1.1
  
   

{code}
Project 2 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
   4.0.0
test
project2
1.0.0-SNAPSHOT


org.hamcrest
hamcrest-core
1.3



{code}
And Project 1 uses a package which can be found in both hamcrest-core and 
hamcrest-all:
{code:java}
import org.hamcrest.core.IsEqual;

class Test {
IsEqual isEqual;
}
{code}
When doing a dependency analysis for Project 1, no "Used undeclared" are 
expected to be seen, because Project 1 declares a dependency on hamcrest-all.

However, I get:

[INFO] — maven-dependency-plugin:2.8:analyze (default-cli) @ project1 —
 [WARNING] Used undeclared dependencies found:
 [WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile

  was:
If a certain package is defined in 2 different artifacts, and a a maven module 
declares a dependency on these 2 artifacts (once through a transitive 
dependency and once using a declared dependency), dependency analyzer reports 
the transitive dependency as "Used Undeclared", while declared dependencies 
should always take precedence (even if they appear later in the POM)

For example:

Project 1 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0
   test
project1
1.0.0-SNAPSHOT
   
  
 test
 project2
 1.0.0-SNAPSHOT
  
  
 org.hamcrest
 hamcrest-all
 1.1
  
   

{code}
Project 2 pom:
{code:java}

http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
   4.0.0
test
project2
1.0.0-SNAPSHOT


org.hamcrest
hamcrest-core
1.3



{code}
And Project 1 uses a package which can be found in both hamcrest-core and 
hamcrest-all:
{code:java}
import org.hamcrest.core.IsEqual;

class Test {
IsEqual isEqual;
}
{code}
When doing a dependency analysis for Project 1, no "Used undeclared" are 
expected to be seen, because Project 1 declares a dependency on hamcrest-all.

However, I get:

[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) @ project1 ---
[WARNING] Used undeclared dependencies found:
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:compile


> Dependency analyzer gets confused if the same package is defined in 2 
> different artifacts
> -
>
> Key: MDEP-609
> URL: https://issues.apache.org/jira/browse/MDEP-609
> Project: Maven Dependency Plugin
>  Issue Type: Bug
>  Components: analyze
>Affects Versions: 3.1.0
>Reporter: Ahmed Hammad
>Priority: Major
>
> If a certain package is defined in 2 different artifacts, and a a maven 
> module declares a dependency on these 2 artifacts (once through a transitive 
> dependency and once using a declared dependency), dependency analyzer reports 
> the dependency as "Used Undeclared", while declared dependencies should 
> always take precedence (even if they appear later in the POM)
> For example:
> Project 1 pom:
> {code:java}
> 
> http://maven.apache.org/POM/4.0.0;
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd;>
> 4.0.0
>test
> project1
> 1.0.0-SNAPSHOT
>
>   
>  test
>  project2
>  1.0.0-SNAPSHOT
>   
>   
>