1. 程式人生 > >匯入CXF例項中的maven專案報錯

匯入CXF例項中的maven專案報錯

       今天想學習下CXF的開發,於是上apache官網下載了一個apache-cxf-2.7.8.zip包,解壓縮後在samples目錄下找了找,準備匯入wsdl_first_soap12專案研究下,由於這是個maven工程,於是在springsource中以maven工程方式匯入這個專案,可惜匯入就報錯了

報錯資訊:

ArtifactTransferException: Failure to transfer org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.8 from http://192.168.19.38:8081/nexus/content/groups/public/

was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.8 from/to central (http://192.168.19.38:8081/nexus/content/groups/public/): No response received after 60000

解決方式:

        執行maven update :在package explorer檢視中右擊專案  --->   Maven  --->   Update Project  --->   點選OK

上面的錯誤沒有了,可惜專案還是報錯了

報錯資訊:

Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.7.8:wsdl2java failed: Plugin org.apache.cxf:cxf-codegen-plugin:2.7.8 or one of its dependencies could not be resolved: The following artifacts could not be resolved

: com.sun.xml.bind:jaxb-xjc:jar:2.2.6, org.springframework:spring-beans:jar:3.0.7.RELEASE, org.springframework:spring-context:jar:3.0.7.RELEASE, org.springframework:spring-aop:jar:3.0.7.RELEASE, org.apache.ant:ant:jar:1.8.4: Failure to transfer com.sun.xml.bind:jaxb-xjc:jar:2.2.6 from http://192.168.19.38:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.sun.xml.bind:jaxb-xjc:jar:2.2.6 from/to central (http://192.168.19.38:8081/nexus/content/groups/public/): No response received after 60000 (org.apache.cxf:cxf-codegen-plugin:2.7.8:wsdl2java:generate-sources:generate-sources) pom.xml /wsdl_first_soap12 line 49 Maven Build Problem

解決方式:

        現在再次執行maven update一直不管用,還是報錯。仔細看了下錯誤資訊,應該是pom檔案中配置的外掛的依賴包沒有下載到本地倉庫

com.sun.xml.bind:jaxb-xjc:jar:2.2.6  、  org.springframework:spring-beans:jar:3.0.7.RELEASE 、 org.springframework:spring-context:jar:3.0.7.RELEASE 、org.springframework:spring-aop:jar:3.0.7.RELEASE 、 org.apache.ant:ant:jar:1.8.4  

根據報錯資訊中提示的GAV資訊到本地倉庫中對應目錄下(如何根據GAV資訊在本地倉庫下查詢響應構件可參考http://blog.csdn.net/liuxigiant/article/details/17240283文章中倉庫佈局的說明)檢視,資料夾都存在,但是沒有jar包。所以執行幾次maven update都是沒用的。

1、刪除報錯構件的本地倉庫的儲存目錄,例如:org.springframework:spring-beans:jar:3.0.7.RELEASE構件,可以把3.0.7.RELEASE這層目錄刪除

2、執行maven update(刪除本地倉庫,maven構建專案的時候會先從本地倉庫查詢,本地倉庫沒找到才會去私服中下下載,所以本地倉庫中目錄若是存在但是jar包不存在的話,maven就不會去中央倉庫下載)

3、若某一個構件下載還是下載不下來,可以手動下載放到對應目錄下。 例如:構件jaxb-xjc-2.2.6.jar一直下載不下來,最後直接上網下載了一個jaxb-xjc-2.2.6.jar包,放到本地倉庫的對應目錄下。

現在專案終於不報錯了,可以開始研究CXF了。。。。