Apache Tomcat Maven Plugin
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-240

Artifacts with same artifactID but different groupID are skipped

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: commons-lib
    • Labels:
      None
    • Environment:
      all

      Description

      Hi guys,

      I have the following situation: my classpath includes the following artifacts:
      1) artifactA in group com.mygroup
      2) artifactA in group com.myothergroup.

      Looking in DefaultClassLoaderEntriesCalculator.java on line 120 we see the following:

                              String fileName = artifact.getFile().getName();
                              if ( !fileInClassLoaderEntries.contains( fileName ) ) {
                                         // add the artifact to the classpath
                              }
      

      So in my case both artifacts are resolved as artifactA-1.0-SNAPSHOT.jar so the second one gets omitted. I have chaged to code to simply include the categoryID like this:

                              String fileName = artifact.getGroupId() + "-" + artifact.getFile().getName();
                              if ( !fileInClassLoaderEntries.contains( fileName ) ) {
                                        //add to classpath
                              }
      

      and it works like a charm.
      You can find the patch attached. Please review it and apply.

      1. MTOMCAT-240.patch
        1 kB
        Petar Tahchiev

        Activity

        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        I wonder if more than one jars have the same how does it when the files are packaged in WEB-INF/lib ?

        Show
        Olivier Lamy (*$^¨%`£) added a comment - I wonder if more than one jars have the same how does it when the files are packaged in WEB-INF/lib ?
        Hide
        Petar Tahchiev added a comment -

        It copies both, but changes their names (prepends the groupId). In WEB-INF/lib I see:

        com.xxxxx.foo-core-0.6-SNAPSHOT.jar
        com.yyyyyyy.bar-core-0.6-SNAPSHOT.jar
        
        Show
        Petar Tahchiev added a comment - It copies both, but changes their names (prepends the groupId). In WEB-INF/lib I see: com.xxxxx.foo-core-0.6-SNAPSHOT.jar com.yyyyyyy.bar-core-0.6-SNAPSHOT.jar
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        doh I didn't know war plugin do that.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - doh I didn't know war plugin do that.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        patch applied.
        Thanks!

        Show
        Olivier Lamy (*$^¨%`£) added a comment - patch applied. Thanks!
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in TomcatMavenPlugin-mvn3.x #256 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/256/)
        MTOMCAT-240 Artifacts with same artifactID but different groupID are skipped
        Submitted by Petar Tahchiev (olamy: http://svn.apache.org/viewvc/?view=rev&rev=1528073)

        • /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
        Show
        Hudson added a comment - SUCCESS: Integrated in TomcatMavenPlugin-mvn3.x #256 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/256/ ) MTOMCAT-240 Artifacts with same artifactID but different groupID are skipped Submitted by Petar Tahchiev (olamy: http://svn.apache.org/viewvc/?view=rev&rev=1528073 ) /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Petar Tahchiev
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development