我使用Eclipse构建了一个maven web app,并在目标中设置了此命令:install tomcat:deploy
。当我构建应用程序时,我遇到了这个错误:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web4 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ web4 ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/kokhoe/workspace/web4/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ web4 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ web4 ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/kokhoe/workspace/web4/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ web4 ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ web4 ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ web4 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [web4] in [/home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/kokhoe/workspace/web4/src/main/webapp]
[INFO] Webapp assembled in [71 msecs]
[INFO] Building war: /home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ web4 ---
[INFO] Installing /home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT.war to /home/kokhoe/.m2/repository/org/huahsin/web4/0.0.1-SNAPSHOT/web4-0.0.1-SNAPSHOT.war
[INFO] Installing /home/kokhoe/workspace/web4/pom.xml to /home/kokhoe/.m2/repository/org/huahsin/web4/0.0.1-SNAPSHOT/web4-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) @ web4 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ web4 ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/kokhoe/workspace/web4/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ web4 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ web4 ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/kokhoe/workspace/web4/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ web4 ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ web4 ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ web4 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [web4] in [/home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/kokhoe/workspace/web4/src/main/webapp]
[INFO] Webapp assembled in [14 msecs]
[INFO] Building war: /home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ web4 <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ web4 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.938s
[INFO] Finished at: Mon Sep 17 12:16:34 MYT 2012
[INFO] Final Memory: 18M/215M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project web4: Cannot find context file: /home/kokhoe/workspace/web4/target/web4-0.0.1-SNAPSHOT/META-INF/context.xml -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
错误提到缺少context.xml。我可以知道这个问题怎么解决?
答案 0 :(得分:0)
我在maven目标中使用此命令解决了问题:
install tomcat:run