[jetty-user] Jetty 8 and Maven Jetty Plugin jetty:run-war not working
rowatt <[email protected]> Sat, 17 Mar 2012 00:15:09 -0700 (PDT)
| Newsgroups | gmane.comp.java.jetty.support |
|---|---|
| Message-ID | <[email protected]> |
Ive' been trying to run a very simple servlet 3.0 with no web.xml using
spring 3.1 (see source code below). When I use the maven jetty plugin by
calling
/mvn clean jetty:run-war/
the spring 3.1 SpringServletContainerInitializer servlet is detected but it
does not call the onStartup method of my XyzWebApplicationInitializer. But
if I run the following:
/mvn clean jetty:run/
then my XyzWebApplicationInitializer servlet is detected and the "TESTING"
message is printed to stdout.
Is this a bug or what have I done wrong?
Thanks, shane.
*com.xyz.jetty.XyzWebApplicationInitializer.java*
package com.xyz.jetty;
import org.springframework.web.WebApplicationInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
public class XyzWebApplicationInitializer implements
WebApplicationInitializer {
public void onStartup(ServletContext servletContext) throws
ServletException {
System.out.println("TESTING");
}
}
*POM.XML*
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>xyz-jetty</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Xyz Jetty</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0.20100224</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.1.v20120215</version>
</plugin>
</plugins>
</build>
</project>
--
View this message in context: http://jetty.4.n6.nabble.com/Jetty-8-and-Maven-Jetty-Plugin-jetty-run-war-not-working-tp4627356p4627356.html
Sent from the Jetty Support mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email