2010-11-11 64 views
1

當我嘗試用Maven 3而不是Maven 2.1運行我的項目時,我從jetty-maven-plugin中得到一個異常。 Maven 2.1一切正常。jetty-maven-plugin不能用於Maven 3

的配置是這樣的:

<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 [email protected]@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 [email protected]: java.lan 
g.NoSuchMethodError: javax.servlet.ServletContext.createFilter(Ljava/lang/Class; 
)Ljavax/servlet/Filter; 
2010-11-11 12:53:01.224:WARN::FAILED [email protected]: 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的插件使用Maven 3?

回答

0

看起來像servlet-api的依賴性問題。

2

這可能與JETTY-1257中的問題相同。試用插件的8.0.0.M2版本。

+0

+1爲好鏈接 – 2010-11-12 07:57:05

+0

謝謝!你知道一個版本庫8.0.0.M2中包含插件嗎?我試過的所有回購都沒有包含它。 – deamon 2010-11-13 13:02:20

+0

@deamon:看起來版本還沒有發佈,你將不得不使用SNAPSHOT。也許[從這裏](https://oss.sonatype.org/content/repositories/jetty-with-staging/org/mortbay/jetty/jetty-maven-plugin/8.0.0.M2-SNAPSHOT/)。另一種方法是獲取源代碼並自己構建插件。 – 2010-11-13 16:12:12