Jetty Jspc Maven Plugin

I’ve added a new maven2 plugin that does jsp pre-compilation. Just like the Jetty Maven Plugin, the new plugin detects whether jsp2.0 or jsp2.1 is required at runtime and generates the correct classes accordingly.

All you need to do is to configure the plugin in your pom.xml and you can have your jsps compiled and your web.xml file updated ready for going into production without having to resort to ant build files.

I have a few ideas for improvements, so I’m interested in communicating with users who have particular requirements, so please check it out and send an email to jetty-discuss@sourceforge.net with your feedback.

The plugin is available from svn head of jetty at the moment, but we’ll push a 6.1-SNAPSHOT to the maven repos soon.

Jspc Precompilation Plugin for Maven

7 thoughts on “Jspc Precompilation Plugin for Maven

  • September 2, 2006 at 10:26 am
    Permalink

    That’s cool! How does this compare to the jspc-maven-plugin that we’ve been using from mojo?

  • September 3, 2006 at 10:25 pm
    Permalink

    The jspc-maven-plugin from codehaus mojo uses only tomcat 5.5.15, whereas this one will use either 5.5.15 or glassfish.

    Also, the jspc-maven-plugin uses the java compiler that maven uses, whereas this plugin uses the same compiler that you use in dev mode for on-the-fly compilation, which is the Eclipse java compiler.

    Some other differences are:
      + you don’t have to specify a marker in the web.xml for where to insert the generated servlet-mappings. For servlet2.4 and above, the order of elements in web.xml is not significant, so the plugin can just automatically append it to the end of the existing web.xml.

    + you can generate the smap stuff for jsr45 compliant debugging

    + supports some other glassfish-only compilation options

    + this plugin is bound to the process-classes phase whereas the other one is bound to the compile phase. As maven 2.0.4 and below doesn’t guarantee the order of execution of plugins, binding to the compile phase doesn’t guarantee that the java classes in the webapp will have already been compiled by the time the jspc-maven-plugin runs. This way guarantees that the jsp compilation slots in nicely between the compile and package phases.

  • September 28, 2006 at 9:39 pm
    Permalink

    As maven 2.0.4 and below doesn’t guarantee the order of execution of plugins, binding to the compile phase doesn’t guarantee that the java classes in the webapp will have already been compiled by the time the jspc-maven-plugin runs.

    This is incorrect.  the jspc-maven-plugin guarantees the compile occurs by forcing a second pass.  You are right that the forking has no guarantee in maven 2.0.4, but the jspc-maven-plugin ensures the compile occurs.

  • December 8, 2006 at 9:18 pm
    Permalink

    I am trying to determine how I can set this up for GNU Classpath. I used the example here, this produces compiled code for my jsp. However I think it produces code that is dependent on sun’s version of Java and not GNU Classpath, ie. I get an exception refering to java.awt.Panel. I believe I need to setup up a dependency for the maven jasper plugin?

    Thanks for your help.

  • July 17, 2007 at 3:30 am
    Permalink

    Hello,

    Do you know if this is still a problem, or has it been fixed with a newer version of maven?

    Also – if this is still a problem, couldn’t it be fixed by using (and ordering) profiles instead?

     

    Thanks,

    TimB

  • July 17, 2007 at 3:55 am
    Permalink

    Hi TimB,

    This isn’t a problem for the jetty jspc plugin – the comment was with reference to the tomcat-based jspc plugin.

    regards
    Jan

  • October 8, 2008 at 9:34 am
    Permalink

    This blog Is very informative , I am really pleased to post my comment on this blog . It helped me with ocean of knowledge so I really belive you will do much better in the future . Good job web master .

Comments are closed.