eclipse下建立maven project後報錯
阿新 • • 發佈:2018-12-11
新增Tomcat 伺服器
- 右鍵單擊專案——>properties——>Java Build Path——>Libraries——>Add Library——>Server Runtime
更改執行時環境的版本
- 找到maven的settings.xml檔案——>找到<profiles>標籤並新增以下配置
<profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile>
新增WEB-INF資料夾、web.xml配置檔案等
- 右鍵點選工程——>選擇Properties——>選擇Project Facets——>取消勾選Dynamic Web Module——>Apply ——>勾選Dynamic Web Module——>選擇Further configuration available——>Content directory的內容改成src/main/webapp ——>選擇ok——>點選Apply