我使用eclipse configure->转换为MVN并且还添加了与google api相关的POM中的所有依赖关系。当我使用mvn jetty:run时,我不断得到以下错误。请让我知道如何解决这个问题。
[INFO] Building glass-qrlens 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.26:run (default-cli) > test-compile @ glass-qrlens >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ glass-qrlens ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\sridharg\git\glass-qrlens\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ glass-qrlens ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ glass-qrlens ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\sridharg\git\glass-qrlens\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ glass-qrlens ---
[INFO] No sources to compile
[INFO]
[INFO] <<< maven-jetty-plugin:6.1.26:run (default-cli) < test-compile @ glass-qrlens <<<
[INFO]
[INFO] --- maven-jetty-plugin:6.1.26:run (default-cli) @ glass-qrlens ---
[INFO] Configuring Jetty for project: glass-qrlens
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.843 s
[INFO] Finished at: 2014-10-25T15:49:55-05:00
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.26:run (default-cli) on project glass-qrlens: Webapp source directory C:\Users\sridharg\git\glass-
qrlens\src\main\webapp does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.26:run (default-cli) on project glass-qrlens: Weba
pp source directory C:\Users\sridharg\git\glass-qrlens\src\main\webapp does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Webapp source directory C:\Users\sridharg\git\glass-qrlens\src\main\webapp does not exist
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.checkPomConfiguration(AbstractJettyRunMojo.java:228)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:395)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
谢谢, Sridhar G
答案 0 :(得分:3)
默认情况下,Maven Web项目将使用目录src/main/webapp
作为webresources。
jetty-maven-plugin
并不知道您使用的是其他目录,因此您收到此错误。
您可以使用类似
的内容<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.3.v20140905</version>
<configuration>
<webAppSourceDirectory>${project.basedir}/WebContent/</webAppSourceDirectory>
<configuration>
</plugin>
使jetty-maven-plugin使用不同的webapp目录。
Jetty现在是一个Eclipse项目,我在答案中使用了相同的内容,但是您当前使用的旧项目确实支持webAppSourceDirectory
配置。