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.


7 Comments

Brett Porter · 02/09/2006 at 10:26

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

Jan Bartel · 03/09/2006 at 22:25

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.

Jeff Genender · 28/09/2006 at 21:39

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.

Anonymous · 08/12/2006 at 21:18

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.

TimB · 17/07/2007 at 03:30

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

Jan Bartel · 17/07/2007 at 03:55

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

John Beck Real Estate · 08/10/2008 at 09:34

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.