jetty-maven-plugin不适用于Maven 3

时间:2010-11-11 12:10:29

标签: java maven-2 servlets jetty maven-3

当我尝试使用Maven 3而不是Maven 2.1运行我的项目时,我从jetty-maven-plugin获得了一个例外。 Maven 2.1一切都很好。

配置如下所示:

<plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.0.0.M1</version>
        <configuration>
          <scanIntervalSeconds>1</scanIntervalSeconds>
          <stopPort>9966</stopPort>
          <stopKey>foo</stopKey>
        </configuration>
      </plugin>

和这样的例外:

2010-11-11 12:53:01.217:WARN::FAILED guiceFilter: java.lang.NoSuchMethodError: j
avax.servlet.ServletContext.createFilter(Ljava/lang/Class;)Ljavax/servlet/Filter
;
2010-11-11 12:53:01.219:WARN::FAILED JettyWebAppContext@58d51a54@58d51a54/,file:
/C:/path/to/webapp/,file:
/C:/path/to/webapp/: java
.lang.NoSuchMethodError: javax.servlet.ServletContext.createFilter(Ljava/lang/Cl
ass;)Ljavax/servlet/Filter;
2010-11-11 12:53:01.223:WARN::FAILED ContextHandlerCollection@77c118ae: java.lan
g.NoSuchMethodError: javax.servlet.ServletContext.createFilter(Ljava/lang/Class;
)Ljavax/servlet/Filter;
2010-11-11 12:53:01.224:WARN::FAILED HandlerCollection@263b84ee: java.lang.NoSuc
hMethodError: javax.servlet.ServletContext.createFilter(Ljava/lang/Class;)Ljavax
/servlet/Filter;
2010-11-11 12:53:01.226:WARN::Error starting handlers
java.lang.NoSuchMethodError: javax.servlet.ServletContext.createFilter(Ljava/lan
g/Class;)Ljavax/servlet/Filter;
        at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:94)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.ja
va:698)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletC
ontextHandler.java:279)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.jav
a:999)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandle
r.java:610)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContex
tHandler.java:155)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:384
)
        at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContex
t.java:127)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCol
lection.java:165)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(Con
textHandlerCollection.java:162)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCol
lection.java:165)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrappe
r.java:92)
        at org.eclipse.jetty.server.Server.doStart(Server.java:243)
        at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:67)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMo
jo.java:437)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.
java:377)
        at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:546)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:107)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:195)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:148)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:140)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)

如何使用Maven 3执行jetty-maven-plugin?

2 个答案:

答案 0 :(得分:2)

这可能与JETTY-1257中的问题相同。尝试使用插件的8.0.0.M2版本。

答案 1 :(得分:0)

看起来很像servlet-api的依赖问题。