[jira] [Commented] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16505841#comment-16505841 ] Seckin Onur SELAMET commented on MDEP-609: -- [~khmarbaise] can you please confirm my comment above? I think this issue can be closed. > 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 > 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 -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501643#comment-16501643 ] Seckin Onur SELAMET edited comment on MDEP-609 at 6/5/18 12:22 PM: --- * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior is still observable. It is related with how classpath is constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under these conditions dependency plugin is just reporting it correctly. :) The implementation for IsEqual class is provided by hamcrest-core-1.1.jar because hamcrest-core-1.1.jar is the earliest entry in the classpath that has IsEqual class. Edit : Some typos. was (Author: soselamet): * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior is still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under these
[jira] [Comment Edited] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501643#comment-16501643 ] Seckin Onur SELAMET edited comment on MDEP-609 at 6/5/18 12:22 PM: --- * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior is still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under these conditions dependency plugin is just reporting it correctly. :) The implementation for IsEqual class is provided by hamcrest-core-1.1.jar because hamcrest-core-1.1.jar is the earliest entry in the classpath that has IsEqual class. Edit : Some typos. was (Author: soselamet): * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under these conditions
[jira] [Comment Edited] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501643#comment-16501643 ] Seckin Onur SELAMET edited comment on MDEP-609 at 6/5/18 11:55 AM: --- * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under these conditions dependency plugin is just reporting it correctly. :) The implementation for IsEqual class is provided by hamcrest-core-1.1.jar because hamcrest-core-1.1.jar is the earliest entry in the classpath that has IsEqual class. was (Author: soselamet): * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under this conditions dependency plugin is just
[jira] [Comment Edited] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501643#comment-16501643 ] Seckin Onur SELAMET edited comment on MDEP-609 at 6/5/18 11:55 AM: --- * This issue can be related with MNG-6415 under some conditions but with this analysis it is not the case. I used a fixed maven version. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under this conditions dependency plugin is just reporting it correctly. :) The implementation for IsEqual class is provided by hamcrest-core-1.1.jar because hamcrest-core-1.1.jar is the earliest entry in the classpath that has IsEqual class. was (Author: soselamet): * This issue can be related with MNG-6415 under some conditions but with this simple example it is not the case. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under this conditions dependency plugin is just reporting it correctly. :)
[jira] [Commented] (MDEP-609) Dependency analyzer gets confused if the same package is defined in 2 different artifacts
[ https://issues.apache.org/jira/browse/MDEP-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16501643#comment-16501643 ] Seckin Onur SELAMET commented on MDEP-609: -- * This issue can be related with MNG-6415 under some conditions but with this simple example it is not the case. * The reported behavior still observable. It is related with how classpath constructed. _*Dependency plugin is not the root cause.*_ I used a modified pom file for project 2 to have one more level ( for more visible distance) in the dependency tree. {code:xml} 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.mockito mockito-core 1.9.5 {code} TREE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:tree (default-cli) @ project1 --- [INFO] test:project1:jar:1.0.0-SNAPSHOT [INFO] +- test:project2:jar:1.0.0-SNAPSHOT:compile [INFO] | \- org.mockito:mockito-core:jar:1.9.5:compile [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] | \- org.objenesis:objenesis:jar:1.0:compile [INFO] \- org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} ANALYZE {noformat} [INFO] --- maven-dependency-plugin:3.1.0:analyze (default-cli) @ project1 --- [WARNING] Used undeclared dependencies found: [WARNING]org.hamcrest:hamcrest-core:jar:1.1:compile [WARNING] Unused declared dependencies found: [WARNING]test:project2:jar:1.0.0-SNAPSHOT:compile [WARNING]org.hamcrest:hamcrest-all:jar:1.1:compile {noformat} CLASSPATH (took the testCompile classpath on purpose to see it was affected by MNG-6415 or not) {noformat} [DEBUG] Classpath: [DEBUG] C:\dev\dummy\P1\target\test-classes [DEBUG] C:\dev\dummy\P1\target\classes [DEBUG] C:\dev\Java\maven_repo\test\project2\1.0.0-SNAPSHOT\project2-1.0.0-SNAPSHOT.jar [DEBUG] C:\dev\Java\maven_repo\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar [DEBUG] C:\dev\Java\maven_repo\org\objenesis\objenesis\1.0\objenesis-1.0.jar [DEBUG] C:\dev\Java\maven_repo\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar {noformat} Under this conditions dependency plugin is just reporting it correctly. :) The implementation for IsEqual class is provided by hamcrest-core-1.1.jar because hamcrest-core-1.1.jar is the earliest entry in the classpath that has IsEqual class. > 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 > 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: >
[jira] [Commented] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16484571#comment-16484571 ] Seckin Onur SELAMET commented on MNG-6415: -- I kindly disagree with that statement. Java classloader cares about the order of the entries listed in classpath. So the other applications/tools those are built on top of it or those are helping java community to be more productive must follow the same approach. That statement can be an advice for a developer to avoid this kind of bugs or some design rules violated by artifact providers but it is not a technical rule Java features. > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > Attachments: > [MNG-6415]_Fixes_Project_Artifact_Cache_classpath_order_retaining_issue_.patch > > > Project artifacts cache does not retain the order of classpath entries. > Wrong Object type used in implementation. HashSet can not guarantee the order > of elements. > In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. > > Possible fix is provided in comments section. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Seckin Onur SELAMET updated MNG-6415: - Description: Project artifacts cache does not retain the order of classpath entries. Wrong Object type used in implementation. HashSet can not guarantee the order of elements. In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. Possible fix is provided in comments section. was: Project artifact cache introduced does not retain the order of classpath entries. Wrong Object type used in implementation. HashSet can not guarantee the order of elements contained. In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. Possible fix is provided in comments section. > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > Attachments: > [MNG-6415]_Fixes_Project_Artifact_Cache_classpath_order_retaining_issue_.patch > > > Project artifacts cache does not retain the order of classpath entries. > Wrong Object type used in implementation. HashSet can not guarantee the order > of elements. > In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. > > Possible fix is provided in comments section. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16483775#comment-16483775 ] Seckin Onur SELAMET edited comment on MNG-6415 at 5/22/18 1:13 PM: --- Rev no : be223808939d75152d7157db33d45f230114555e Class : DefaultProjectArtifactsCache Line : 208 {color:#ff}_new CacheRecord( Collections.unmodifiableSet( new HashSet<>( projectArtifacts ) ) );_{color} Must be implemented as: new CacheRecord( Collections.unmodifiableSet( new LinkedHashSet<>( projectArtifacts ) ) ); Patch is also available in attachments. was (Author: soselamet): Rev no : be223808939d75152d7157db33d45f230114555e Line : 208 {color:#FF}_new CacheRecord( Collections.unmodifiableSet( new HashSet<>( projectArtifacts ) ) );_{color} Must be implemented as: new CacheRecord( Collections.unmodifiableSet( new LinkedHashSet<>( projectArtifacts ) ) ); > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > Attachments: > [MNG-6415]_Fixes_Project_Artifact_Cache_classpath_order_retaining_issue_.patch > > > Project artifact cache introduced does not retain the order of classpath > entries. > Wrong Object type used in implementation. HashSet can not guarantee the order > of elements contained. > In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. > > Possible fix is provided in comments section. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Seckin Onur SELAMET updated MNG-6415: - Attachment: [MNG-6415]_Fixes_Project_Artifact_Cache_classpath_order_retaining_issue_.patch > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > Attachments: > [MNG-6415]_Fixes_Project_Artifact_Cache_classpath_order_retaining_issue_.patch > > > Project artifact cache introduced does not retain the order of classpath > entries. > Wrong Object type used in implementation. HashSet can not guarantee the order > of elements contained. > In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. > > Possible fix is provided in comments section. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Seckin Onur SELAMET updated MNG-6415: - Description: Project artifact cache introduced does not retain the order of classpath entries. Wrong Object type used in implementation. HashSet can not guarantee the order of elements contained. In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. Possible fix is provided in comments section. > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > > Project artifact cache introduced does not retain the order of classpath > entries. > Wrong Object type used in implementation. HashSet can not guarantee the order > of elements contained. > In runtime ProjectArtifacts passed as LinkedHashSet already which is safe. > > Possible fix is provided in comments section. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
[ https://issues.apache.org/jira/browse/MNG-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16483775#comment-16483775 ] Seckin Onur SELAMET commented on MNG-6415: -- Rev no : be223808939d75152d7157db33d45f230114555e Line : 208 {color:#FF}_new CacheRecord( Collections.unmodifiableSet( new HashSet<>( projectArtifacts ) ) );_{color} Must be implemented as: new CacheRecord( Collections.unmodifiableSet( new LinkedHashSet<>( projectArtifacts ) ) ); > Project Artifacts Cache does not retain the order of classpath entries. > --- > > Key: MNG-6415 > URL: https://issues.apache.org/jira/browse/MNG-6415 > Project: Maven > Issue Type: Bug > Components: core >Affects Versions: 3.5.2 > Environment: Windows 7, JDK8u144 >Reporter: Seckin Onur SELAMET >Priority: Major > Labels: CLASSPATH > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (MNG-6415) Project Artifacts Cache does not retain the order of classpath entries.
Seckin Onur SELAMET created MNG-6415: Summary: Project Artifacts Cache does not retain the order of classpath entries. Key: MNG-6415 URL: https://issues.apache.org/jira/browse/MNG-6415 Project: Maven Issue Type: Bug Components: core Affects Versions: 3.5.2 Environment: Windows 7, JDK8u144 Reporter: Seckin Onur SELAMET -- This message was sent by Atlassian JIRA (v7.6.3#76005)