我想在GWT上尝试Spring-MVC,为此我找到了这种原型。当我在本地下载它并运行时mvn clean && mvn install
,它会生成一个jar文件,但是第二项pom.xml中该项目的包装是WAR类型。为了在tomcat中部署它,我添加了该项目的compile-output,但仍然无法运行该项目。我正在添加错误日志和屏幕截图。有人还能帮我理解项目结构吗?谢谢你。
对不起,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>
屏幕截图:
这不是您使用原型的方式:您需要运行mvn archetype:generate
,它将为您生成一个项目(基于“内部” POM)。您甚至不需要克隆和构建原型项目本身。实际上,确切的命令在自述文件中给出:https : //github.com/kolorobot/spring-mvc-quickstart-archetype/#create-a-project
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句