2012-06-08 71 views
2

我有一些Java項目與我,我想在Windows中使用Maven構建它。但是我在做這件事時遇到了一些錯誤。我已經使用了命令如何通過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 

我只想問如何,如果我得到的一些問題解決的依賴關係。 我對maven瞭解不多,因此一直都遇到這樣的問題

請指教。

感謝

+1

** ** OT是惱人的:你應該更喜歡' -DskipTests'而不是'-Dmaven.test.skip',因爲第一個將始終構建測試類,但是會跳過運行它們,而後者甚至不構建它們。通過這樣做你就知道構建是正確的。甚至可能有人在使用需要它們的最新測試工件。看到這個[鏈接](http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html) – maba

+0

@maba:我試着用你指定的選項-DskipTests,但結果是一樣的。 :( –

+0

當然可以,我沒有發佈解決方案,只是一些其他的幫助,因此OT(關閉主題)。 – maba

回答

0

XXX XXX ....從/向中央(http://repo1.maven.org/maven2):連接到http://repo1.mave n.org拒絕:連接超時:接 - >

似乎當maven試圖從它的存儲庫下載依賴項,它無法建立連接。幾個選項..

  1. 確保Internet連接可用
  2. 運行安裝,而不-o開關
  3. 配置Maven的代理服務器設置( http://maven.apache.org/guides/mini/guide-proxies.html
  4. 有時需要一些依賴於從特定庫下載(例如 - jboss存儲庫中的jboss依賴項),因此可能需要向pom添加特定的存儲庫
2

另外,inste從中央下載工件的廣告,嘗試設置您自己的「企業存儲庫」。

  • 這將減輕該服務器
  • 這的負載將減輕負擔您的企業網絡bandwidht(我的是非常非常有限的;)
  • 你會設法delpoy你擁有神器上。

這隻需要......一個服務器(物理或虛擬)和一個tomcat。 你應該閱讀本免費書籍:http://www.sonatype.com/books/mvnref-book/reference/

主要產品有:

這並不是很困難,雖然它出現時,你以爲你只是要安裝Maven,讓你的POM,並繼續:)

相關問題