title: How to use proxy with Tycho maven plugin?
body: <p>I'm trying to build the Eclipse Kura project from behind a corporate firewall.</p>
  
  <p>When I try to build kura/examples/org.eclipse.kura.example.camel.aggregation (<code>mvn clean install</code>), it ends with :</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I've tried to set up a proxy with :</p>
  
  <pre><code>               &lt;plugin&gt;
                          &lt;groupId&gt;org.eclipse.tycho&lt;/groupId&gt;
                          &lt;artifactId&gt;tycho-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;${tycho-version}&lt;/version&gt;
                          &lt;extensions&gt;true&lt;/extensions&gt;
                          &lt;configuration&gt;
                                  &lt;argLine&gt;-Dhttp.proxyHost=my-proxy-web -Dhttp.proxyPort=3128&lt;/argLine&gt;
                          &lt;/configuration&gt;
                  &lt;/plugin&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>When I setup the same proxy in a browser, I can reach "<a href="http://packagedrone.eclipse.org/p2/eclipse-kura-2.1" rel="nofollow noreferrer">http://packagedrone.eclipse.org/p2/eclipse-kura-2.1</a>"</p>
  
  <p>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 :</p>
  
  <pre><code>  &lt;proxies&gt;
      &lt;proxy&gt;
        &lt;id&gt;main-proxy&lt;/id&gt;
        &lt;active&gt;true&lt;/active&gt;
        &lt;protocol&gt;http&lt;/protocol&gt;
        &lt;host&gt;my-proxy-web&lt;/host&gt;
        &lt;port&gt;3128&lt;/port&gt;
        &lt;nonProxyHosts&gt;*.mycomp.fr&lt;/nonProxyHosts&gt;
      &lt;/proxy&gt;
    &lt;/proxies&gt;
  </code></pre>
  
  <p>UPDATE 2 :</p>
  
  <p>maven debug logs when running with -X and -s settings.xml :</p>
  
  <pre><code>[DEBUG] Clearing proxy settings in OSGi runtime
  </code></pre>
  
  <p>(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)</p>
  
  <pre><code>[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
  </code></pre>
  
  <p>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.</p>
  
  <p>Here is the output with a proxy correctly setup (still failing) :</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>And if I setup explicitly the system properties asked in the warning :</p>
  
  <pre><code>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.
  </code></pre>