Maven学习笔记
错误1:An error has occurred when creating this preference page
解决办法:
将环境变量Path中%JAVA_HOME%\bin;置于path最前面解决问题
错误2:webxml attribute is required
[ERROR] 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) ->
[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:
解决:maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。解决方法在pom.xml加入以下的配置。红色背景字体改成你网站的根目录。
< 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包
< 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包方法
mvn clean complie process-classes war:exploded