2012-09-17 31 views
2

我有一个使用Eclipse构建的maven web应用程序,并且在此目标中设置了以下命令:install tomcat:deploy。当我构建应用程序时,我遇到了以下错误:如何在maven构建期间解决丢失的context.xml?

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

确需位于您的context.xml?您是否在编译部分添加了 ...(没有xml exluding?)到您的pom中? –

回答

0

我必须在Maven的目标使用此命令解决了这个问题:

install tomcat:run

相关问题