2013-02-27 165 views
0

我無法使用jar包來構建maven maodule。我得到錯誤爲無法使用Maven Project下的jar包構建maven模塊...!

Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from http://repo1.maven.org/maven2 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.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to central (http://repo1.maven.org/maven2): ConnectException 

我的機器被標記爲公司網絡,是他們的任何代理問題?我試着用下面的創建settings.xml中:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
         http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
    <localRepository>${user.home}/.m2/repository</localRepository> 
    <interactiveMode>true</interactiveMode> 
    <usePluginRegistry>false</usePluginRegistry> 
    <offline>false</offline> 
    <pluginGroups/> 
    <servers/> 
    <mirrors/> 
    <proxies> 
    <!-- proxy 
    | Specification for one proxy, to be used in connecting to the network. 
    |--> 
    <proxy> 
     <id>optional</id> 
     <active>true</active> 
     <protocol>http</protocol>  
     <host>proxy.tcs.com</host> 
     <port>80</port> 
     <nonProxyHosts>localhost|google.com</nonProxyHosts> 
    </proxy> 

    </proxies> 
    <profiles/> 
    <activeProfiles/> 
</settings> 

我能夠創建POM包裝子模塊,但不與罐子,PLS建議

如果我嘗試更新Maven項目配置,則顯示控制檯如下圖所示:

2/27/13 1:08:12 PM IST: Unable to update index for central|http://repo1.maven.org/maven2 
2/27/13 1:08:12 PM IST: Updating index central|http://repo1.maven.org/maven2 
2/27/13 1:11:37 PM IST: Refreshing settings C:\Users\346496\.m2\settings.xml 
2/27/13 1:50:58 PM IST: Update started 
2/27/13 1:50:59 PM IST: Update completed: 0 sec 
2/27/13 1:51:04 PM IST: Update started 
2/27/13 1:51:04 PM IST: Generating sources /common/pom.xml 
2/27/13 1:51:04 PM IST: Build error for /common/pom.xml; org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 
2/27/13 1:51:04 PM IST: Downloaded http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom 
2/27/13 1:51:04 PM IST: Failed to determine compiler source setting, assuming default 
2/27/13 1:51:04 PM IST: Failed to determine compiler target setting, assuming default 
2/27/13 1:51:04 PM IST: Failed to determine compiler source setting, assuming default 
2/27/13 1:51:04 PM IST: Failed to determine compiler target setting, assuming default 
2/27/13 1:51:04 PM IST: Failed to determine compiler test inclusions, assuming defaults 
2/27/13 1:51:04 PM IST: Failed to determine compiler test exclusions, assuming defaults 
2/27/13 1:51:04 PM IST: Failed to determine compiler inclusions, assuming defaults 
2/27/13 1:51:04 PM IST: Failed to determine compiler exclusions, assuming defaults 
2/27/13 1:51:04 PM IST: Adding source folder /common/src/main/java 
2/27/13 1:51:04 PM IST: Adding resource folder /common/src/main/resources 
2/27/13 1:51:04 PM IST: Adding source folder /common/src/test/java 
2/27/13 1:51:04 PM IST: Adding resource folder /common/src/test/resources 
2/27/13 1:51:04 PM IST: Update completed: 0 sec 

我已經配置Maven的鏈接http://m2eclipse.sonatype.org/sites/m2e與Eclipse版本朱諾和JDK 1.7。 我嘗試了所有可能的解決方案,但沒有成功。

+0

您是否有權訪問http://repo1.maven.org/maven2? – 2013-02-27 08:22:38

+0

nope,當我點擊該網址時,其說法是:瀏覽該目錄已被禁用。 改爲在http://search.maven.org上查看此目錄的內容。 – user1787641 2013-02-27 08:23:55

+0

如果上述鏈接被公司阻止,它會顯示爲公司封鎖該網站。 – user1787641 2013-02-27 08:26:54

回答

1

問題在於代理設置,因爲我們在公司使用代理網絡Maven無法正確下載它的插件,所以使用代理設置添加settings.xml文件,工作正常。