From a0023f48522108306b5803f6d358196ed1a9b79a Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 11 Dec 2006 22:25:29 +0000 Subject: [PATCH] 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 --- WHATSNEW | 10 +++- docs/manual/proxy.html | 80 +++++++++++-------------- docs/manual/running.html | 2 +- src/main/org/apache/tools/ant/Main.java | 10 ++-- 4 files changed, 49 insertions(+), 53 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 3e6860bf3..bd7f59ec3 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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 =========================================== diff --git a/docs/manual/proxy.html b/docs/manual/proxy.html index de7fab79b..df9365887 100644 --- a/docs/manual/proxy.html +++ b/docs/manual/proxy.html @@ -25,6 +25,11 @@

Proxy Configuration

+

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

+

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.

- 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 - java.net.useSystemProxies system property, telling the JVM to - switch to the OS-configured proxy settings.This is automatic, but it can be disabled. -

-

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

-

Java1.5 automatic proxy support (new for Ant1.7)

+

Java1.5+ proxy support (new for Ant1.7)

- When Ant starts up, it automatically sets the + When Ant starts up, if the -autoproxy + command is supplied, Ant sets the java.net.useSystemProxies 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. -

-

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

- To disable this automatic feature, set the command line option - -noproxy, or set a JVM or Ant property - java.net.useSystemProxies to a value other than - true or on. 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.

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.

- 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 an adaptive - laptop, the host's proxy settings will not-automatically adapt to - changes in network context. The -noproxy option may be a useful - one to use when roaming. + not adapt to changes in proxy settings. +

+ + +

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

+ +

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

JVM options

@@ -132,11 +132,6 @@ proxy configuration.
  • Does not work under IDEs. These need their own proxy settings changed
  • Not dynamic enough to deal with laptop configuration changes.
  • -

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

    SetProxy Task

    @@ -184,18 +179,11 @@ proxy configuration. There are three ways to set up proxies in Ant.

      -
    1. Automatically, with Ant1.7 -use -noproxy to disable this.
    2. +
    3. With Ant1.7 using the -autoproxy parameter.
    4. Via JVM system properties -set these in the ANT_ARGS environment variable.
    5. Via the <setproxy> task.
    -

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

    Further reading

    diff --git a/docs/manual/running.html b/docs/manual/running.html index 1689cba7c..90c24afaf 100644 --- a/docs/manual/running.html +++ b/docs/manual/running.html @@ -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 <class> override Ant's normal entry point

    For more information about -logger and diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index 85be5ea0d..0bcf2462d 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -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 override Ant's normal entry point"); System.out.println(msg.toString()); }