Browse Source

automatic proxy handling is only there if -autoproxy is set; marked as such in the docs. -noproxy is removed.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@485920 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 18 years ago
parent
commit
a0023f4852
4 changed files with 49 additions and 53 deletions
  1. +9
    -1
      WHATSNEW
  2. +34
    -46
      docs/manual/proxy.html
  3. +1
    -1
      docs/manual/running.html
  4. +5
    -5
      src/main/org/apache/tools/ant/Main.java

+ 9
- 1
WHATSNEW View File

@@ -9,6 +9,9 @@ Changes that could break older environments:
not available, or if explicitly requested by using
a "manager" attribute.

* The -noproxy option which was in the previous 1.7 alpha and beta
releases has been removed. It is the default behavior and not needed.

Fixed bugs:
-----------
* Directory deletion did not work properly.
@@ -63,7 +66,12 @@ Other changes:
EnumeratedAttribute. Bugzilla 41058.

* Create a pom file for ant-testutil and add ant-testutil.jar to the ant
distribution. Bugzilla 40980.
distribution. Bugzilla 40980.

* Roll back automatic proxy enabling on Java 1.5. It broke things like
Oracle JDBC drivers, and Ant itself on IBM's JVM on AIX, and didnt
seem to work to well the rest of the time.
To enable the feature, use the -autoproxy command line option.

Changes from Ant 1.7.0Beta3 to Ant 1.7.0RC1
===========================================


+ 34
- 46
docs/manual/proxy.html View File

@@ -25,6 +25,11 @@
<body>
<h2>Proxy Configuration</h2>

<p>
This page discussing proxy issues on command-line ant.
Consult your IDE documentation for IDE-specific information upon proxy setup.
</p>

<p>

All tasks running in Ant's JVM share the same HTTP/FTP/Socks
@@ -44,42 +49,29 @@ proxy configuration.
does not work behind the firewall.
</p>
<p>
This is a longstanding problem with Java and Ant, which Java1.5 finally
addresses. When Ant is run under Java1.5, it automatically sets the
<code>java.net.useSystemProxies</code> system property, telling the JVM to
switch to the OS-configured proxy settings.This is automatic, but it can be disabled.
</p>
<p>
When running Ant on older JVMs, this property is ignored. There are two other
ways to configure Ant's proxy settings in these cases.
This is a long standing problem with Java and Ant. The only way to fix
it is to explictly configure Ant with the proxy settings, either
by passing down the proxy details as JVM properties, or to
tell Ant on a Java1.5+ system to have the JVM work it out for itself.

</p>



<h3>Java1.5 automatic proxy support (new for Ant1.7)</h3>
<h3>Java1.5+ proxy support (new for Ant1.7)</h3>
<p>
When Ant starts up, it automatically sets the
When Ant starts up, if the <code>-autoproxy</code>
command is supplied, Ant sets the
<code>java.net.useSystemProxies</code> system property. This tells
a Java1.5+ JVM to use the current set of property settings of the host
environment. Other JVMs, such as the Kaffe and Apache Harmony runtimes,
may also use this property in future, which is why Ant always sets the
property -it is ignored on the Java1.4 and earlier runtimes.
</p>
<p>
This property should be enough to automatically give Ant hosted
builds network access. It may also work under an IDE, though that depends
upon the IDE and how it starts ant. If it bypasses Ant's Main entry point,
the proxy setup may be skipped, and if networking has already started up
by the time ant is run, the option may be ignored. Consult your IDE
documentation for IDE-specific information upon proxy setup.
may also use this property in future.
It is ignored on the Java1.4 and earlier runtimes.
</p>
<p>
To disable this automatic feature, set the command line option
<tt>-noproxy</tt>, or set a JVM or Ant property
<code>java.net.useSystemProxies</code> to a value other than
<code>true</code> or <code>on</code>. If the JVM option is already set,
Ant will not touch it; if an Ant property of that name is set, Ant will
pass the value of that property down to the JVM.
This property maybe enough to give command-line Ant
builds network access, although in practise the results
are somewhat disappointing.
</p>
<p>
We are not entirely sure where it reads the property settings from.
@@ -87,14 +79,22 @@ proxy configuration.
Unix/Linux it may use the current Gnome2 settings.
<p>
The biggest limitation of this feature, other than requiring a 1.5+ JVM,
One limitation of this feature, other than requiring a 1.5+ JVM,
is that it is not dynamic. A long-lasting build hosted on a laptop will
not adapt to changes in proxy settings. Furthermore, unless the user
is running <a
href="http://www.hpl.hp.com/techreports/2001/HPL-2001-158.html">an adaptive
laptop</a>, the host's proxy settings will not-automatically adapt to
changes in network context. The <code>-noproxy</code> option may be a useful
one to use when roaming.
not adapt to changes in proxy settings.
</p>


<p>
It is has also been reported a breaking the IBM Java 5 JRE on AIX,
and does not appear to work reliably on Linux.
Other odd things can go wrong, like Oracle JDBC drivers or pure Java SVN clients.
</p>

<p>
To make the <code>-autproxy</code> option the default, add it to the environment variable
<code>ANT_ARGS</code>, which contains a list of arguments to pass to Ant on every
command line run.
</p>

<h3>JVM options</h3>
@@ -132,11 +132,6 @@ proxy configuration.
<li>Does not work under IDEs. These need their own proxy settings changed</li>
<li>Not dynamic enough to deal with laptop configuration changes.</li>
</ol>
<p>
If you are using Ant on a pre-Java1.5 machine behind a firewall, this is
the simplest and best way to configure your runtime to work with build files
that go beyond the firewall.
</p>

<h3>SetProxy Task</h3>
<p>
@@ -184,18 +179,11 @@ proxy configuration.
There are three ways to set up proxies in Ant.
</p>
<ol>
<li>Automatically, with Ant1.7 -use <code>-noproxy</code> to disable this.</li>
<li>With Ant1.7 using the <code>-autoproxy</code> parameter.</li>
<li>Via JVM system properties -set these in the ANT_ARGS environment variable.</li>
<li>Via the &lt;setproxy&gt; task.</li>
</ol>

<p>
As Java1.5 adoption increases, automatic proxy support should become more
widespread. For this reason, we would encourage users not to try and
second-guess network configurations with setproxy, and instead to encourage
users to move up to Ant1.7/Java1.5, and if they cannot, to set proxy options
in the ANT_ARGS environment variable.
</p>

<h4>Further reading</h4>



+ 1
- 1
docs/manual/running.html View File

@@ -127,7 +127,7 @@ Options:
1 (lowest) to 10 (highest); 5 is the default
-nouserlib Run ant without using the jar files from ${user.home}/.ant/lib
-noclasspath Run ant without using CLASSPATH
-noproxy Java 1.5 only: do not use the OS proxies
-autoproxy Java 1.5+ : use the OS proxies
-main &lt;class&gt; override Ant's normal entry point
</pre>
<p>For more information about <code>-logger</code> and


+ 5
- 5
src/main/org/apache/tools/ant/Main.java View File

@@ -125,9 +125,9 @@ public class Main implements AntMain {
private Integer threadPriority = null;

/**
* proxy flag: default is true
* proxy flag: default is false
*/
private boolean proxy = true;
private boolean proxy = false;

/**
* Prints the message of the Throwable if it (the message) is not
@@ -452,7 +452,7 @@ public class Main implements AntMain {
+ "\nThis can be caused by a version mismatch between "
+ "the ant script/.bat file and Ant itself.";
throw new BuildException(msg);
} else if (arg.equals("-noproxy")) {
} else if (arg.equals("-autoproxy")) {
proxy = false;
} else if (arg.startsWith("-")) {
// we don't have any more args to recognize!
@@ -847,8 +847,8 @@ public class Main implements AntMain {
msg.append(" -nouserlib Run ant without using the jar files from" + lSep
+ " ${user.home}/.ant/lib" + lSep);
msg.append(" -noclasspath Run ant without using CLASSPATH" + lSep);
msg.append(" -noproxy Java 1.5 only: do not use the OS proxies"
+ lSep);
msg.append(" -autoproxy Java1.5+: use the OS proxy settings"
+ lSep);
msg.append(" -main <class> override Ant's normal entry point");
System.out.println(msg.toString());
}


Loading…
Cancel
Save