問題:
Java Web項目在保存或加載web.xml時耗時太長問題。
web.xml內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
</web-app>
解決辦法:
方法一:斷網。這種方式可以解決,但不方便開發。
方法二:修改web.xml。修改爲如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
</web-app>
修改的地方有:
1.將version版本由4.0變爲3.0
2.web-app_4_0.xsd變爲web-app_3_0.xsd
3.將所有的http://xmlns.jcp.org/xml/ns/javaee 變爲 http://java.sun.com/xml/ns/javaee
參考:https://stackoverflow.com/questions/6621210/eclipse-takes-long-time-to-save-web-xml
完成!enjoy it!