今天想学习下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
下载jar包是访问的http://192.168.19.38:8081/nexus/content/groups/public/路径,是由于我本地搭建了nexus私服(192.168.19.38是我本机IP),并做了镜像,所以这应该是没问题的
上面的错误没有了,可惜项目还是报错了
报错信息:
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了。。。。