1. 程式人生 > >geqianqing KEEP IT SIMPLE STUPID !

geqianqing KEEP IT SIMPLE STUPID !

Maven建立所遇到的問題記錄:

第一次搭建ssm框架,eclipse搭建maven時候,遇到了各種奇葩奇怪的問題,各種百度Google,終無解。

偶然看見的maven官網maven對jdk版本的要求,記錄下來,希望大家少像我一樣走彎路。

不正確的地方也請大家指正!

也希望有沒有提到的錯誤請大家留言。

1. maven下src--main--webapp--index.jsp報紅叉

報錯:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

原因:pom.xml未引入java

解決方案:   <dependency>  
           <groupId>javax</groupId>  
            <artifactId>javaee-api</artifactId>  
            <version>7.0</version>  
            </dependency> 

2. maven專案下pom.xml下packaging報錯

錯誤程式碼記不清楚了
Execution default-testResources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:testResources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:testResources: org/codehaus/plexus/util/StringUtils 
這個是對應的檔案沒有下載到本地造成的,建議刪除下載對應xml中,重新下載。

3. maven專案下java resources報紅叉

DescriptionResourcePathLocationType
JavaServer Faces 2.2 can not be installed : One or more constraints have not been satisfied.stormline 1Maven Java EE Configuration Problem
JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer.stormline 1Maven Java EE Configuration Problem
Description ResourcePath LocationType
JAX-RS (REST Web Services) 2.0 can not be installed : One or more constraints have not been satisfied. stormline 1 Maven Java EE Configuration Problem
Description ResourcePath LocationType
JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer.stormline 1Maven Java EE Configuration Problem
原因:個人認為是版本對應問題,博主用的jdk1.7,使用maven3.2.1時報錯。查了好久,不管是update project還是
手動更改Dynamic Web Module 都沒有作用,最後查官網對於版本對應要求如下圖:


換成最新版maven3.3.9對應jdk1.7;不再報這四個錯誤。

4. maven專案下java resources報感嘆號

原因:版本對應問題
解決方案:解決方案:專案右擊propreties--java build path -libraries - JRE System Library - EDIT - 選擇workplace default jre

5. 警告資訊

DescriptionResourcePathLocationType
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. stormBuild pathJRE System Library Problem

解決方案:專案右擊propreties--Project Facets--Java中version選對應的版本資訊;

各位有其他錯誤資訊可留言探討,problems 下打印出的資訊

(window -- show view - others - 搜尋 problems )

轉載請宣告出處!