我想用GWT嘗試Spring-MVC,爲此我找到了this原型。當我在本地下載它並運行mvn clean && mvn install
時,它會生成一個jar文件,但第二個pom.xml中的項目打包爲WAR類型。爲了在tomcat中部署它,我添加了項目的編譯輸出,但我仍然無法運行該項目。我正在添加錯誤日誌和截圖。有人能幫助我瞭解項目結構嗎?謝謝。Spring,Maven:無法使用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>
截圖:
你說的工作,你能告訴我如何從Intellij ide運行這個項目並生成部署的war文件。謝謝。 –
它的工作,非常感謝.. :-) –