2017-04-26 56 views
0

我想從企業防火牆後面構建Eclipse Kura項目。如何在Tycho maven插件中使用代理?

當我嘗試建立庫拉/例子/ org.eclipse.kura.example.camel.aggregation(mvn clean install),它結束與:

Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'eclipse.kura' from location http://packagedrone.eclipse.org/p2/eclipse-kura-2.1 
(...) 
Caused by: java.lang.RuntimeException: Failed to load p2 repository with ID 'eclipse.kura' from location http://packagedrone.eclipse.org/p2/eclipse-kura-2.1 
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository(TargetPlatformFactoryImpl.java:296) 
(...) 
Caused by: java.net.SocketTimeoutException: Read timed out 

我試圖建立一個代理有:

   <plugin> 
         <groupId>org.eclipse.tycho</groupId> 
         <artifactId>tycho-maven-plugin</artifactId> 
         <version>${tycho-version}</version> 
         <extensions>true</extensions> 
         <configuration> 
           <argLine>-Dhttp.proxyHost=my-proxy-web -Dhttp.proxyPort=3128</argLine> 
         </configuration> 
       </plugin> 

但它沒有奏效。 Kura項目使用tycho-maven-plugin的v0.20.0,我試圖升級到1.0.0,但它沒有工作。

當我安裝在瀏覽器相同的代理,我可以達到「http://packagedrone.eclipse.org/p2/eclipse-kura-2.1

更新: 我也已經定義了我的Maven的settings.xml中,其工作是在尋找各種信息庫的依賴代理,但與-X和-s的settings.xml運行時

行家調試日誌:

<proxies> 
    <proxy> 
     <id>main-proxy</id> 
     <active>true</active> 
     <protocol>http</protocol> 
     <host>my-proxy-web</host> 
     <port>3128</port> 
     <nonProxyHosts>*.mycomp.fr</nonProxyHosts> 
    </proxy> 
    </proxies> 

更新2:未通過第谷maven插件考慮

[DEBUG] Clearing proxy settings in OSGi runtime 

(這是「代理」所對應的第谷插件源代碼,沒有「配置代理服務器」,並沒有「忽略代理」的,只有提起,就像沒有「主動」代理已發現)

[INFO] Computing target platform for MavenProject: org.eclipse.kura:org.eclipse.kura.example.camel.aggregation:1.1.0 @ /home/tristan/Dev/projects/IOT/kura.git/kura/examples/org.eclipse.kura.example.camel.aggregation/pom.xml 
[DEBUG] Added p2 repository eclipse.kura (http://packagedrone.eclipse.org/p2/eclipse-kura-2.1) 
[DEBUG] Using execution environment 'JavaSE-1.7' configured in Bundle-RequiredExecutionEnvironment 
[DEBUG] Registered artifact repository org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey(uri=file:/[email protected]/home/tristan/Dev/projects/IOT/kura.git/kura/examples/org.eclipse.kura.example.camel.aggregation) 
[INFO] Adding repository http://packagedrone.eclipse.org/p2/eclipse-kura-2.1 
[WARNING] Failed to access p2 repository http://packagedrone.eclipse.org/p2/eclipse-kura-2.1, use local cache. 
org.eclipse.equinox.p2.core.ProvisionException: Unable to read repository at http://packagedrone.eclipse.org/p2/eclipse-kura-2.1/content.xml. 
(...) 
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to packagedrone.eclipse.org:80 timed out 

更新3: 我的「UPDATE 2」上的錯誤,我做了很多測試,有太多的設置,我在這個測試中使用了錯誤的文件。

這是與代理正確設置(仍然失敗)輸出:

mvn clean install -X -s good-settings-with-proxy.xml 

[DEBUG] Clearing proxy settings in OSGi runtime 
[DEBUG] Configuring proxy for protocol http: host=10.91.31.45, port=3128 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106 
!MESSAGE System property http.proxyHost is not set but should be 10.91.31.45. 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106 
!MESSAGE System property http.proxyPort is not set but should be 3128. 

如果我建立明確的制度性的警告問:

mvn clean install -X -Dhttp.proxyHost=10.91.31.45 -Dhttp.proxyPort=3128 -s /home/tristan/CODE/apache-maven-3.2.3/conf/settings.with-proxy.xml 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.079 
!MESSAGE System property http.proxyHost has been set to 10.91.31.45 by an external source. This value will be overwritten using the values from the preferences 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.079 
!MESSAGE System property http.proxyPort has been set to 3128 by an external source. This value will be overwritten using the values from the preferences 
[DEBUG] Clearing proxy settings in OSGi runtime 
[DEBUG] Configuring proxy for protocol http: host=10.91.31.45, port=3128, nonProxyHosts=*.edf.fr 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106 
!MESSAGE System property http.proxyHost is not set but should be 10.91.31.45. 

!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106 
!MESSAGE System property http.proxyPort is not set but should be 3128. 
+0

在你的settings.xml文件中定義代理... – khmarbaise

+0

正如你所猜測的那樣,它已經在那裏定義了,它可以達到依賴關係,但不適用於Tycho。 – Tristan

+0

您是否正確定義了settings.xml中給定存儲庫標識的代理? – khmarbaise

回答

0

khmarbaise是正確的,你應該配置在maven的settings.xml中的代理

maven調試日誌(mvn乾淨安裝-X)應該給你輸出從

https://github.com/eclipse/tycho/blob/f42e43c5722c0f74e55c5c03259476ac8b6f8836/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java#L65

如果沒有,你的代理服務器設置沒有考慮到由於某種原因

有關HTTP客戶端級別進一步調試,使用Apache HTTP客戶端跟蹤,看到 https://wiki.eclipse.org/Equinox/p2/Reporting_Problems - >報告網絡連接問題

另一個先決條件要仔細檢查是否您的構建實際上沒有代理和一個乾淨的本地maven回購。

+0

你是什麼意思我「應該在maven的settings.xml中配置代理」,除了我的問題結尾處顯示的內容之外的其他內容?我不明白你的第一句話,如果它相對於我已寫或不寫的設置,但我會嘗試激活你在Tycho源文件中找到的調試日誌,這聽起來很有用。 – Tristan

+0

調試跟蹤添加了所有「代理」提及。 – Tristan

+0

我在我的「更新2」中犯了一個錯誤,好的輸出是在「更新3」(仍然失敗) – Tristan

相關問題