spring - 部署示例 Spring Web MVC 项目

标签 spring tomcat spring-mvc

我是 Tomcat、Maven 和 Spring Web MVC(准确地说是框架 v3)的新手。我正在尝试构建 example项目 mvc-basic 以便我可以在测试服务器(非本地)上部署生成的 WAR 文件并分析效果。

当我在包含 pom.xml 的目录中运行 Maven 时,我看到了这些模糊的错误消息。

pdedecker@linux-qhij:~/Dropbox/Unief/GWT/mvc/mvc-basic/trunk> ~/Apps/apache-maven-3.0.3/bin/mvn pom.xml
[INFO] Scanning for projects...                                                                                                                                                                      
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.springframework.samples:mvc-basic:war:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 124, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. @ line 133, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mvc-basic 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.132s
[INFO] Finished at: Thu Apr 28 13:26:39 CEST 2011
[INFO] Final Memory: 2M/57M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "pom.xml". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException

我对编译器提到的事情知之甚少。如何生成 WAR 文件?我缺少哪些工具?

最佳答案

您需要运行mvn package

WAR文件运行后会出现在target子文件夹中。

另请参阅:

关于spring - 部署示例 Spring Web MVC 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5817980/

相关文章:

spring - 从 loadUserByUsername 访问证书内容

tomcat - 使用来自 Docker 的 tomcat 图像时具有自定义 catalina.sh

java - 在没有 war 的情况下在 tomcat 上运行 Java Web 应用程序

java - 将 spring 事务传播到兄弟调用

java - 逐渐填充InputStream并用SpringMVC返回

java - Spring 重定向不起作用,只显示重定向 :/url in browser

eclipse - 用tomcat/eclipse远程调试,其他共享系统

spring - @Autowired - 没有为依赖至少 1 个 bean 找到符合条件的 bean

java - org.springframework.beans.factory.NoSuchBeanDefinitionException : No bean named 'leadDAO' is defined

java - 如何在 Spring Boot 中为嵌入式 Jetty 设置 Handler?