Maven 1.x War Plugin
  1. Maven 1.x War Plugin
  2. MPWAR-30

[PATCH] Option to pack project classes inside a JAR into WEB-INF/lib

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      2

      Description

      The way the plugin works now, the project classes are packed under WEB-INF/classes. It would be nice if the plugin used the project's JAR instead, packing it under WEB-INF/lib. That feature would be really useful when the war is a secondary package for the project (for instance, when the main artifact is a JAR containg a taglib).

      I'm providing a patch for this change - if there is interest in applying it, I can write some test cases too.

      1. maven_war_usesJar.patch
        5 kB
        Felipe Leme
      2. MPWAR-30.diff
        7 kB
        fabrizio giustina

        Activity

        Hide
        Jamie Bisotti added a comment -

        I've mentioned this before on the mailing list...Maven needs to be careful to balance "the Maven way" vs. making things that should be trivial, hard on users. As someone mentioned above, this is strictly about packaging within a WAR; separate projects just to get your classes JAR'ed and placed in WEB-INF/lib is extreme overkill.

        Show
        Jamie Bisotti added a comment - I've mentioned this before on the mailing list...Maven needs to be careful to balance "the Maven way" vs. making things that should be trivial, hard on users. As someone mentioned above, this is strictly about packaging within a WAR; separate projects just to get your classes JAR'ed and placed in WEB-INF/lib is extreme overkill.
        Hide
        Brill Pappin added a comment -

        I remember asking for this a while back. In my case I wanted to be able to get package information (build/revision, company etc) when an exception occured in a webapp. In the end I had to use a rather ugly custom solution to do it.

        I don't actually think it's against the "Maven Way"... it just makes the WAR a little cleaner and allows the use of the java.lang.Package class to actually get information about the class in question (it mostly uses the manifest). It also makes deploying hot-fixes simple as you only need to replace on jar file.

        I see this as a simple property, off be default that will tell the war plugin to bundle it all up in a jar and copy that instead of simply sending all the raw classes to /target/webapp/WEB-INF/classes... in fact even though its adding another operation to the war goal, it might make it faster as a copy tends to be slow.

        Anyway, I've added another vote for it, and hope to see it in the future.

        Show
        Brill Pappin added a comment - I remember asking for this a while back. In my case I wanted to be able to get package information (build/revision, company etc) when an exception occured in a webapp. In the end I had to use a rather ugly custom solution to do it. I don't actually think it's against the "Maven Way"... it just makes the WAR a little cleaner and allows the use of the java.lang.Package class to actually get information about the class in question (it mostly uses the manifest). It also makes deploying hot-fixes simple as you only need to replace on jar file. I see this as a simple property, off be default that will tell the war plugin to bundle it all up in a jar and copy that instead of simply sending all the raw classes to /target/webapp/WEB-INF/classes... in fact even though its adding another operation to the war goal, it might make it faster as a copy tends to be slow. Anyway, I've added another vote for it, and hope to see it in the future.
        Hide
        fabrizio giustina added a comment -

        updated patch, adds the jar generation as a prerequisite

        Show
        fabrizio giustina added a comment - updated patch, adds the jar generation as a prerequisite
        Hide
        Felipe Leme added a comment -

        I'm unassigning it as I haven't been able to do any Maven work on the last 2-3 months and the situations doesn't seem to be changing in the short time

        Show
        Felipe Leme added a comment - I'm unassigning it as I haven't been able to do any Maven work on the last 2-3 months and the situations doesn't seem to be changing in the short time
        Hide
        Martin Zeltner added a comment -

        I had a look at the source code of today's svn trunk and saw that the jar is created individually. I suggest to check first if there is already a created jar (created by maven-jar-plugin) and use this if it exists. In this case you can benefit from the power of the maven-jar-plugin (edit manifest for example).

        Cheers,
        Martin

        Show
        Martin Zeltner added a comment - I had a look at the source code of today's svn trunk and saw that the jar is created individually. I suggest to check first if there is already a created jar (created by maven-jar-plugin) and use this if it exists. In this case you can benefit from the power of the maven-jar-plugin (edit manifest for example). Cheers, Martin

          People

          • Assignee:
            Unassigned
            Reporter:
            Felipe Leme
          • Votes:
            7 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified