2

I'm trying to build the Eclipse Kura project from behind a corporate firewall.

When I try to build kura/examples/org.eclipse.kura.example.camel.aggregation (mvn clean install), it ends with :

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

I've tried to set up a proxy with :

               <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>

But it didn't work. The Kura project is using v0.20.0 of tycho-maven-plugin, I've tried to upgrade to 1.0.0 but it didn't work.

When I setup the same proxy in a browser, I can reach "http://packagedrone.eclipse.org/p2/eclipse-kura-2.1"

UPDATE : I have also already defined my proxy in maven settings.xml, which works to find dependencies in various repositories, but which is not taken into account by Tycho maven plugin :

  <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>

UPDATE 2 :

maven debug logs when running with -X and -s settings.xml :

[DEBUG] Clearing proxy settings in OSGi runtime

(This is the only mention of "proxy" corresponding to the Tycho plugin source, no "Configuring proxy" and no "Ignoring proxy", it's like no "active" proxy has been found)

[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:/resolution-context-artifacts@/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

UPDATE 3 : My bad on "UPDATE 2", I've done so many tests with so many settings I used the wrong file for this test.

Here is the output with a proxy correctly setup (still failing) :

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.

And if I setup explicitly the system properties asked in the warning :

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.
Tristan
  • 8,733
  • 7
  • 48
  • 96

2 Answers2

3

Tycho derives its configuration from settings.xml, you will need to provide both http and https proxy elements with different IDs(in order to avoid getting overlapped in Tycho configuration file) in Maven's settings.xml.

<proxies>
  <proxy>
    <id>123</id>
    <active>true</active>
    <protocol>https</protocol>
    <host>my-proxy-web</host>
    <port>3128</port>
    <nonProxyHosts>*.mycomp.fr</nonProxyHosts>
  </proxy>
  <proxy>
    <id>321</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>my-proxy-web</host>
    <port>3128</port>
    <nonProxyHosts>*.mycomp.fr</nonProxyHosts>
  </proxy>
</proxies>
Dhanushka
  • 216
  • 3
  • 7
0

khmarbaise is right, you should configure the proxy in maven's settings.xml

maven debug log (mvn clean install -X) should give you output from

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

If it doesn't, your proxy settings are not taken into account for some reason

For further debugging on the HTTP client level, use apache HTTP client tracing, see https://wiki.eclipse.org/Equinox/p2/Reporting_Problems -> Reporting network connection issues

Another prerequisite to double-check is whether your build actually works without a proxy and with a clean local maven repo.

jsievers
  • 1,853
  • 10
  • 13
  • What do you mean I "should configure the proxy in maven's settings.xml", something else than what is shown at the end of my question ? I don't understand your first sentence, if it's relative to the settings conf I've written or not, but I'll try to activate the debug logs you've found in Tycho sources, it sounds useful. – Tristan Apr 27 '17 at 16:11
  • debug trace added with all "proxy" mentions. – Tristan Apr 28 '17 at 12:55
  • I did a mistake in my "UPDATE 2", the good output is in "UPDATE 3' (still failing) – Tristan Apr 28 '17 at 16:11
  • I suggest to switch on apache HTTP client tracing as described above (or tcpdump/wireshark) to check what's going on on the wire – jsievers Apr 28 '17 at 20:42
  • These are options to debug Eclipse (which has a Tycho plugin too), not Maven. Btw, the eclipse plugin works well, only the Maven plugin has the bug. I think the Maven tycho plugin still behaves as if it was running through Eclipse, a bit like the tycho sunfire plugin : https://wiki.eclipse.org/Tycho/FAQ#How_to_configure_HTTP_proxy_settings_during_test_execution.3F But if I can't find any doc related to it, I'll just drop this crap. – Tristan Apr 29 '17 at 07:18
  • if you use -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG -Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR on the mvn commandline you will get HTTP client tracing. – jsievers May 03 '17 at 08:21