Tagebuch eines Technikers

Thursday, May 15, 2008

PIX application and Jetty

I do not like to install new software on my production environment, especially when it comes to servers. And I'm currently too lazy to start up a virtual machine and configure it as I need to.

Therefore, I'm pretty fond of the maven jetty plugin. Jetty is a Java web server which can be used to serve your content. The good thing: By using the jetty plugin, I can avoid to set-up a full web server. Instead, I only type mvn jetty:run in order to test my web app on localhost:8080.

I copied the necessary plugin information from an Appfuse 2 project and included it into the pom.xml of the PIX application. The lines I included are:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.6</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<excludes>
<exclude>**/*.jsp</exclude>
</excludes>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>
</plugin>


You can even shorten all this stuff down to:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<contextPath>/</contextPath>
</configuration>
</plugin>

By doing this, you do not rely on a particular version as well. The only thing necessary was the contextPath. Otherwise, jetty will complain that there is "No context on this server matched or handled this request." You will have to click on one link to select the correct context.

No comments: