Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war
Maven学习笔记错误1:An error has occurred when creating this preference page
解决办法:
将环境变量Path中%JAVA_HOME%\bin;置于path最前面解决问题
错误2:webxml attribute is required
1
2
3
4
5
6
Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) ->
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
解决:maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。解决方法在pom.xml加入以下的配置。红色背景字体改成你网站的根目录。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>WebContent</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
记录3:dependency引用本地jar包
1
2
3
4
5
6
7
<dependency>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/paypal_base.jar</systemPath>
</dependency>
maven使用module开发生成web工程,不打war包方法
1
mvn clean complie process-classes war:exploded
页:
[1]