Java 在通过Maven构建项目时,如何解决一些依赖关系?

Java 在通过Maven构建项目时,如何解决一些依赖关系?,java,maven,Java,Maven,我有一些Java项目,我正在尝试在Windows中使用Maven构建它。但是我在做这件事的时候犯了一些错误。我把这个命令当作 "mvn -Dmaven.test.skip=true install" 详情如下: [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] OpenEMPI Application ...

我有一些Java项目,我正在尝试在Windows中使用Maven构建它。但是我在做这件事的时候犯了一些错误。我把这个命令当作

"mvn -Dmaven.test.skip=true install" 
详情如下:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OpenEMPI Application .............................. SUCCESS [1.610s]
[INFO] OpenEMPI - Core ................................... SUCCESS [1:39.281s]
[INFO] OpenEMPI - OpenPIXPDQ Adapter ..................... FAILURE [48.469s]
[INFO] OpenEMPI - EJB Interface .......................... SKIPPED
[INFO] OpenEMPI - Web (Struts 2) ......................... SKIPPED
[INFO] OpenEMPI - Web (Server Side) ...................... SKIPPED
[INFO] OpenEMPI - Web (Client Side) ...................... SKIPPED
[INFO] OpenEMPI - EAR .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:31.203s
[INFO] Finished at: Fri Jun 08 04:30:04 CDT 2012
[INFO] Final Memory: 11M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project openempi-openpixpdq-adapter: Could not
 resolve dependencies for project org.openhie.openempi:openempi-openpixpdq-adapt
er:jar:2.0.5: Failed to collect dependencies for [javax.ejb:ejb-api:jar:3.0 (pro
vided), org.openhie.openempi:openempi-core:jar:2.0.5 (compile), org.openhealthex
change.openpixpdq:openpixpdq:jar:1.1 (compile), com.misys.braid:braid-base:jar:1
.2.2 (compile), com.misys.hieportal.sysmon:eventmonitoring:jar:1.0 (compile), ca
.uhn.hapi:hapi:jar:0.5.1 (compile), commons-dbcp:commons-dbcp:jar:1.2.1 (compile
), commons-beanutils:commons-beanutils:jar:1.8.0 (compile), commons-collections:
commons-collections:jar:3.2 (compile), commons-lang:commons-lang:jar:2.3 (compil
e), javax.mail:mail:jar:1.4 (compile), javax.persistence:persistence-api:jar:1.0
 (compile), net.sf.ehcache:ehcache:jar:1.4.1 (compile), org.aspectj:aspectjweave
r:jar:1.6.0 (compile), org.aspectj:aspectjrt:jar:1.6.0 (compile), org.codehaus.x
fire:xfire-java5:jar:1.2.6 (compile), org.codehaus.xfire:xfire-spring:jar:1.2.6
(compile), org.hibernate:hibernate:jar:3.2.6.ga (compile), org.hibernate:hiberna
te-annotations:jar:3.3.0.ga (compile), org.hibernate:hibernate-commons-annotatio
ns:jar:3.3.0.ga (compile), org.jmock:jmock:jar:2.4.0 (compile?), org.jmock:jmock
-junit4:jar:2.4.0 (compile?), org.springframework:spring-jdbc:jar:2.5.4 (compile
), org.springframework:spring-orm:jar:2.5.4 (compile), org.springframework:sprin
g-aop:jar:2.5.4 (compile), org.springframework:spring-aspects:jar:2.5.4 (compile
), org.springframework:spring-context-support:jar:2.5.4 (compile), org.jboss.cli
ent:jbossall-client:jar:4.2.3.GA (test), org.jboss:jnp-client:jar:4.2.2.GA (test
), org.subethamail:subethasmtp-wiser:jar:1.2 (test), velocity:velocity:jar:1.4 (
compile), postgresql:postgresql:jar:8.1-407.jdbc3 (compile), junit:junit:jar:4.4
 (compile?), log4j:log4j:jar:1.2.15 (compile), org.springframework:spring-test:j
ar:2.5.4 (compile?), org.springframework.security:spring-security-core-tiger:jar
:2.0.1 (compile), javax.annotation:jsr250-api:jar:1.0 (compile)]: Failed to read
 artifact descriptor for org.openhealthexchange.openpixpdq:openpixpdq:jar:1.1: C
ould not transfer artifact org.openhealthexchange.openpixpdq:openpixpdq:pom:1.1
from/to central (http://repo1.maven.org/maven2): Connection to http://repo1.mave
n.org refused: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :openempi-openpixpdq-adapter
[信息]------------------------------------------------------------------------
[信息]反应堆概要:
[信息]
[信息]OpenEMPI应用程序。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。成功[1.610s]
[信息]OpenEMPI-核心。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。成功[1:39.281s]
[信息]OpenEMPI-OpenPIXPDQ适配器。。。。。。。。。。。。。。。。。。。。。失败[48.469s]
[信息]OpenEMPI-EJB接口。。。。。。。。。。。。。。。。。。。。。。。。。。跳过
[信息]OpenEMPI-Web(Struts 2)。。。。。。。。。。。。。。。。。。。。。。。。。跳过
[信息]OpenEMPI-Web(服务器端)。。。。。。。。。。。。。。。。。。。。。。跳过
[信息]OpenEMPI-网络(客户端)。。。。。。。。。。。。。。。。。。。。。。跳过
[信息]OpenEMPI-EAR。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。跳过
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:2:31.203s
[信息]完成时间:2012年6月8日星期五04:30:04
[信息]最终内存:11M/60M
[信息]------------------------------------------------------------------------
[错误]无法在项目openempi openpixpdq适配器上执行目标:无法
解析项目org.openhie.openempi的依赖项:openempi openpixpdq adapt
er:jar:2.0.5:未能收集[javax.ejb:ejb api:jar:3.0(pro
openempi:openempi核心:jar:2.0.5(编译),org.openhealthex
change.openpixpdq:openpixpdq:jar:1.1(编译),com.misys.braid:braid base:jar:1
.2.2(编译),com.misys.hieportal.sysmon:eventmonitoring:jar:1.0(编译),ca
.uhn.hapi:hapi:jar:0.5.1(编译),commons-dbcp:commons-dbcp:jar:1.2.1(编译
),commons beanutils:commons beanutils:jar:1.8.0(编译),commons集合:
commons集合:jar:3.2(编译),commons-lang:commons-lang:jar:2.3(编译
e) ,javax.mail:mail:jar:1.4(编译),javax.persistence:persistenceapi:jar:1.0
(编译),net.sf.ehcache:ehcache:jar:1.4.1(编译),org.aspectj:aspectjweave
r:jar:1.6.0(编译),org.aspectj:aspectjrt:jar:1.6.0(编译),org.codehaus.x
fire:xfire-java5:jar:1.2.6(编译),org.codehaus.xfire:xfire-spring:jar:1.2.6
(编译),org.hibernate:hibernate:jar:3.2.6.ga(编译),org.hibernate:hiberna
te注释:jar:3.3.0.ga(编译),org.hibernate:hibernate commons注释
ns:jar:3.3.0.ga(编译),org.jmock:jmock:jar:2.4.0(编译?),org.jmock:jmock
-junit4:jar:2.4.0(编译?),org.springframework:springjdbc:jar:2.5.4(编译?)
),org.springframework:springorm:jar:2.5.4(编译),org.springframework:sprin
g-aop:jar:2.5.4(编译),org.springframework:springaspects:jar:2.5.4(编译)
),org.springframework:spring上下文支持:jar:2.5.4(编译),org.jboss.cli
ent:jbossall客户端:jar:4.2.3.GA(测试),org.jboss:jnp客户端:jar:4.2.2.GA(测试
),org.subethamail:subethasmtp-wiser:jar:1.2(测试),velocity:velocity:jar:1.4(
编译),postgresql:postgresql:jar:8.1-407.jdbc3(编译),junit:junit:jar:4.4
(编译?),log4j:log4j:jar:1.2.15(编译),org.springframework:springtest:j
ar:2.5.4(编译?),org.springframework.security:springsecurity核心tiger:jar
:2.0.1(编译),javax.annotation:jsr250 api:jar:1.0(编译)]:读取失败
org.openhealthchange.openpixpdq:openpixpdq:jar:1.1:C的工件描述符
不能传输工件org.openhealthchange.openpixpdq:openpixpdq:pom:1.1
来往中环(http://repo1.maven.org/maven2):连接到http://repo1.mave
n、 组织被拒绝:连接超时:连接->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e swit重新运行Maven
中国。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请重试
d以下条款:
[错误][帮助1]http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
粘液异常
[错误]
[错误]纠正问题后,可以使用命令恢复生成
[错误]mvn-rf:openempi openpixpdq适配器
我只想问,如果我遇到某些问题,如何解决依赖关系。 我对maven了解不多,因此一直被这样的问题困扰着

请给我一些建议


谢谢,您遇到此问题是因为您的本地计算机无法连接到此位置的主maven存储库:。您可能需要配置maven代理设置

似乎当maven试图从其存储库下载依赖项时,它无法建立连接。几乎没有选择

  • 确保您的internet连接可用
  • 不使用-o开关运行安装
  • 配置maven代理设置( )
  • 有时需要从特定存储库下载一些依赖项(例如,jboss存储库中的jboss依赖项),因此可能需要将特定存储库添加到pom中

  • 此外,不要从Central下载工件,而是尝试建立自己的“企业存储库”

    • 这将减轻此服务器的负载
    • 这将减轻企业互联网带宽的负担(我的非常有限;)
    • 您将设法在上面删除您自己的工件
    这只需要。。。一个服务器(物理或虚拟)和一个tomcat。 你应该读这本免费的书:

    主要产品有:

    • 人工制品:http://www.jfrog.com/products.php
    • 关系:
    这并不是很难,尽管当您认为必须安装maven、制作pom并继续进行时,这似乎很烦人:)

    OT:您应该更喜欢
    -DskipTests
    而不是
    -Dmaven.test.skip
    ,因为第一个将始终构建您的测试类,但在后者运行时跳过运行它们
    xxx xxx .... from/to central (http://repo1.maven.org/maven2):
        Connection to http://repo1.maven.org refused: Connection timed out: connect ->