Jetty
  1. Jetty
  2. JETTY-426

Jetty Maven goals have unnecessary prerequisites

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 6.1.5
    • Fix Version/s: 7.0.0pre3
    • Component/s: Maven
    • Labels:
      None
    • Environment:
      Maven version: 2.0.7
      Java version: 1.5.0_12
      OS name: "linux" version: "2.6.11-1.1369_fc4smp" arch: "i386"
    • Number of attachments :
      0

      Description

      Lately I've had some problems with the fact that the "run-war" and "run-exploded" goals of Jetty's Maven plugin always execute the "package" phase of the lifecycle before launching Jetty. I think the solution to this problem is to change these goals so that they just lunch Jetty without running the "package" phase. The modified goals could either replace the current versions or they could live alongside the existing goals, much like the goals in Maven's "assembly" plugin.

      The reason I think this a problem is that for projects with a lot of dependencies, building the project's war file is by far the most time-consuming part of building the project, and there are cases where building the war file has absolutely no benefit. The most obvious case where the war file is unnecessary is the "run-exploded" goal--I realize that building the war file is the only reliable way to cause the exploded webapp directory to be built, but the problem remains. The other case I've encountered is when the user runs a webapp other than the project's primary artifact by using a -DwebApp=... argument on the command line.

        Activity

        Hide
        Jan Bartel added a comment -

        I'd have hoped that maven would be smart enough not to rebuild the war file if nothing has changed, and one already exists in the build output directory. Perhaps something to bring up with the maven guys?

        I wasn't aware of the -DwebApp argument. Can you tell me in what circumstances you would use it?

        cheers
        Jan

        Show
        Jan Bartel added a comment - I'd have hoped that maven would be smart enough not to rebuild the war file if nothing has changed, and one already exists in the build output directory. Perhaps something to bring up with the maven guys? I wasn't aware of the -DwebApp argument. Can you tell me in what circumstances you would use it? cheers Jan
        Hide
        Jan Bartel added a comment -

        Jesse,

        Any light you can shed on the -DwebApp argument or indeed any way to get the exploaded war built without the actual war being jar'ed up?

        Jan

        Show
        Jan Bartel added a comment - Jesse, Any light you can shed on the -DwebApp argument or indeed any way to get the exploaded war built without the actual war being jar'ed up? Jan
        Hide
        Jesse McConnell added a comment -

        you can't really "change these goals so that they just launch Jetty without running the 'package' phase".

        The package phase is a component of the maven lifecycle and the only way your going to get around this problem is by adding functionality to the maven-war-plugin that will keep it from rebuilding the war during the package phase. You can't really slot the maven-jetty-plugin earlier in the process since you can't be assured that the webapp would have been packaged up and deployed someplace initially. And since the plugin makes use of maven's lifecycle to pull out dependencies to monitor and use it would be difficult to try and run something outside of the maven lifecycle and retain the functionality.

        As for that webApp argument, I think he is referring to the param on the Jetty plugin, which by default is the location of the war produced by the maven-war-plugin. If your overriding that parameter then you are leaving the maven conventions and are kinda off in your own territory.

        I think its a great functionality to add to the maven-war-plugin, but its not trivial really since there is so much in play with that plugin and the various bits and pieces it needs to take into account...which is why its probably not been done yet. That is true for most if not all of the packaging phase maven plugins.

        Show
        Jesse McConnell added a comment - you can't really "change these goals so that they just launch Jetty without running the 'package' phase". The package phase is a component of the maven lifecycle and the only way your going to get around this problem is by adding functionality to the maven-war-plugin that will keep it from rebuilding the war during the package phase. You can't really slot the maven-jetty-plugin earlier in the process since you can't be assured that the webapp would have been packaged up and deployed someplace initially. And since the plugin makes use of maven's lifecycle to pull out dependencies to monitor and use it would be difficult to try and run something outside of the maven lifecycle and retain the functionality. As for that webApp argument, I think he is referring to the param on the Jetty plugin, which by default is the location of the war produced by the maven-war-plugin. If your overriding that parameter then you are leaving the maven conventions and are kinda off in your own territory. I think its a great functionality to add to the maven-war-plugin, but its not trivial really since there is so much in play with that plugin and the various bits and pieces it needs to take into account...which is why its probably not been done yet. That is true for most if not all of the packaging phase maven plugins.
        Hide
        Jesse McConnell added a comment -

        closing this issue, feel free to reopen should there be anything someone wishes to add

        Show
        Jesse McConnell added a comment - closing this issue, feel free to reopen should there be anything someone wishes to add

          People

          • Assignee:
            Jesse McConnell
            Reporter:
            John Williams
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: