Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-240

archiveClasses and attachClasses in 2.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
      Java version: 1.6.0_18
      Default locale: de_DE, platform encoding: Cp1252
      OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

      Description

      There seems to be a regression between 2.1-beta-1 and 2.1 with regard to archiveClasses and attachClasses options.

      My use case:
      I have a WAR project with Java classes and I am setting both archiveClasses and attachClasses to true.
      With 2.1-beta-1 it was working correctly (mvn clean install) --> I got classes packaged into a JAR and placed into WEB-INF/lib and I got that JAR artifact deployed to my Maven repository.

      Just upgraded to 2.1 and I got the following with the same use case: I got classes packaged into a JAR and placed into WEB-INF/lib (correct) and I got an empty JAR artifact (only META-INF/ present) deployed to my Maven repository (incorrect).

      Looking at the code in 2.1 of WarMojo (line 230) I am seeing that the classes folder (for classes to be included into attached artifact) is empty, because it was cleared before due to archiveClasses=true

      Trying to debug both code branches I am seeing a difference between 2.1-beta-1 and 2.1 in that the
      getJarArchiver().getDirs() before the call to packager.packageClasses() method (line 233/234)

      is empty in the 2.1:
      (java.util.HashMap<K,V>) {}

      whereas it is not in 2.1-beta-1. It contains a list of all my classes, perhaps because the same archiver instance was used to package them into JAR for WEB-INF/lib.
      That is why I am getting all my classes in the attached artifact with 2.1-beta-1

      I would really need your help in understanding the "correct" behaviour.
      Is this a regression bug for 2.1 or I am completely wrong in my expectations about archiveClasses and attachClasses used together?

      Kind regards
      Sergiy Shyrkov

      1. effective-pom.out
        7 kB
        Sergiy Shyrkov
      2. mwar-240.patch
        2 kB
        Sergiy Shyrkov
      3. mwar-240-test-case.zip
        3 kB
        Sergiy Shyrkov

        Activity

        Sergiy Shyrkov created issue -
        Sergiy Shyrkov made changes -
        Field Original Value New Value
        Attachment mwar-240-test-case.zip [ 51790 ]
        Attachment effective-pom.out [ 51791 ]
        Sergiy Shyrkov made changes -
        Attachment mwar-240.patch [ 57596 ]
        Arnaud HERITIER made changes -
        Assignee Arnaud Heritier [ aheritier ]
        Arnaud HERITIER made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Arnaud HERITIER made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 2.1.2 [ 17452 ]
        Arnaud HERITIER made changes -
        Time Spent 0.75h [ 2700 ]
        Remaining Estimate 0h [ 0 ]
        Worklog Id 113449 [ 113449 ]
        Kristian Rosenvold made changes -
        Fix Version/s 2.2 [ 15001 ]
        Fix Version/s 2.1.2 [ 17452 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:28:45 UTC 2015 [ 1428240525159 ]
        Mark Thomas made changes -
        Workflow jira [ 12728650 ] Default workflow, editable Closed status [ 12764859 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 01:49:55 UTC 2015 [ 1428284995525 ]
        Mark Thomas made changes -
        Workflow jira [ 12966299 ] Default workflow, editable Closed status [ 13002329 ]

          People

          • Assignee:
            Arnaud HERITIER
            Reporter:
            Sergiy Shyrkov
          • Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 0.75h
              0.75h

                Development