gpt4 book ai didi

java - Spring ,Maven : Unable to deploy module with tomcat

转载 作者:行者123 更新时间:2023-11-28 22:50:33 28 4
gpt4 key购买 nike

我想尝试使用 GWT 的 Spring-MVC,为此我找到了 this原型(prototype)。当我将它下载到本地并运行 mvn clean && mvn install 时,它生成了一个 jar 文件,但是 2nd pom.xml 中项目的打包是 WAR 类型。为了在 tomcat 中部署它,我为项目添加了编译输出,但我仍然无法运行该项目。我正在添加错误日志和屏幕截图。有人也可以帮助我了解项目结构。谢谢。

对 TMI 感到抱歉,不知道到底是什么问题,所以尝试了所有的可能性。

错误日志:

Connected to server
[2016-12-29 01:52:13,364] Artifact unnamed: Artifact is being deployed, please wait...
[2016-12-29 01:52:13,388] Artifact unnamed: Error during artifact deployment. See server log for details.
[2016-12-29 01:52:13,389] Artifact unnamed: com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: /home/akshay/gwt/spring-mvc-quickstart-archetype/out/artifacts/unnamed not found for the web module.
Dec 29, 2016 1:52:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/akshay/Downloads/apache-tomcat-7.0.69/webapps/examples

外层 POM.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.codeleak</groupId>
<artifactId>spring-mvc-quickstart</artifactId>
<version>1.0.0</version>
<packaging>maven-archetype</packaging>
<name>Spring MVC Maven Archetype: Quickstart</name>
<description>Archetype for creating Spring MVC 4 web application</description>
<url>https://github.com/kolorobot/spring-mvc-quickstart-archetype</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>

<version>2.2</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.2</version>

</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

内部 pom.xml :

<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>war</packaging>
<version>${version}</version>
<name>Spring MVC Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version>
<!-- Override Spring version -->
<!-- spring.version>4.3.3.RELEASE</spring.version -->
<!-- Thymeleaf 3 -->
<org.thymeleaf-version>3.0.2.RELEASE</org.thymeleaf-version>
<org.thymeleaf.extras.springsecurity4-version>3.0.0.RELEASE</org.thymeleaf.extras.springsecurity4-version>
<nz.net.ultraq.thymeleaflayout-version>2.0.5</nz.net.ultraq.thymeleaflayout-version>
<thymeleaf-extras-java8time-version>3.0.0.RELEASE</thymeleaf-extras-java8time-version>
<!-- AssertJ is not a part of Spring IO platform, so the version must be provided explicitly -->
<assertj-core-version>3.5.2</assertj-core-version>
</properties>
<parent>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>Athens-SR1</version>
<relativePath/>
</parent>
// And subsequent dependencies

<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warName>${artifactId}-${version}</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>

截图:

enter image description here

enter image description here

enter image description here

最佳答案

这不是您使用原型(prototype)的方式:您需要运行 mvn archetype:generate 并且它会为您生成一个项目(基于“内部”POM)。您甚至不需要克隆和构建原型(prototype)项目本身。实际上,README 中给出了确切的命令:https://github.com/kolorobot/spring-mvc-quickstart-archetype/#create-a-project

关于java - Spring ,Maven : Unable to deploy module with tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41375997/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com