㈠ maven 怎麼配置webapp
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>
${basedir}/webapp
</warSourceDirectory>
<!-- <packagingExcludes>**/*.svn</packagingExcludes>
<warSourceExcludes>**/*.svn</warSourceExcludes>
<warSourceIncludes>**/*.js,**/*.jsp,**/*.jpg,**/*.css,**/*.tld,**/*.xml</warSourceIncludes>
-->
<webXml>${basedir}/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
㈡ 新建的maven為什麼沒有web.xml
第一步,新建maven項目
第二步,選擇web模板
㈢ maven web怎麼修改pom.xml
新建的maven項目,項目內代碼及pom.xml沒有任何問題,但項目上就是有紅叉,這時點開Markers(Window-->show veiw-->Markers),查看錯誤的詳細信息,信息上:Project configuration is not up-to-date with pom.xml. Run project configuration update
按照提示做即可:項目右擊-->Maven-->Update Project Configuration,紅叉即消失。
實際應用中出現紅叉的原因有很多,這時都可以查看Markers里的詳細信息,有的放矢。
㈣ JAVA maven創建web項目,把Spring框架配置文件放在src/main/resources中讀取不到配置文件
classpath:是從類路徑里查找配置文件,也就是/WEB-INF/classes目錄下找SpringMVC-servlet.xml。
你寫了classpath了,不會從web-info下找,而是去web-inf/classes下面找,所以找不到。
㈤ maven開發怎麼配置web.xml
load-on-startup配置在中,見本工程配置。 load-on-startup元素在web應用啟動的時候指定了servlet被載入的順序,它的值必須是一個整數。 在servlet的配置中,1 的含義是:容器在啟動的時候就載入這個servlet。
㈥ maven整合springmvc需要配置web.xml嗎
需要啊,maven起到的作用是不用自己導入相關的jar包和依賴的jar包
㈦ maven總是配置不成功,是什麼原因
遇到的問題和解決
錯誤1 :
[ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve
dependencies for project biz_zhuhai:biz_zhuhai:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies for [com.maywide.ibh:lib345:pom:1.0
(compile)]: Failed to read artifact descriptor for
com.maywide.ibh:lib345:pom:1.0: Could not transfer artifact
com.maywide.ibh:lib345:pom:1.0 from/to releases
(http://localhost:9888/nexus-2.0.3/content/repositories/releases):
Connection to http://localhost:9888 refused: Connection refused: connect
-> [Help 1]
解決:這是配置的url有錯誤或者是私服沒有配好,導致構件下載時出錯。如果沒有jar包需要在私服里下載,可以不配置私服的,可以把setting.xml的profiles里的東西全部刪除的。
錯誤2:[ERROR]
Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test)
on project web_nanchang: There are test failures.
[ERROR]
[ERROR] Please refer to E:\maven\web_nanchang\target\surefire-reports for the indivial test results.
解決:這是因為測試代碼時遇到錯誤,會停止編譯。只需要在pom.xml的<project>里添加以下配置,使得測試出錯不影響項目的編譯。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
錯誤3:
[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) ->
[Help 1]
[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>
錯誤4:
嚴重: The web application [/web_nanchang] registered the JBDC driver
[org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.
2012-4-27 10:36:49 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
嚴重: The web
application [/web_nanchang] registered the JBDC driver
[com.mysql.jdbc.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.
不知道怎樣解決,導致運行不了。
錯誤5:
把java complier改成1.6或者disabled dependency manangent後在enable消失了。
㈧ maven怎麼生成web.xml
項目右鍵-properties-project facets-勾選dynamic web moudle