[ 
https://issues.apache.org/jira/browse/IVY-529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519771
 ] 

James P. White commented on IVY-529:
------------------------------------

Eyeballing the code shows that Ant's SetProxy task just sets the system 
properties, so that should be good for both approaches.

The Ant Get task is doing a lot less work than ivy:retreive as it simply does a 
URL.openConnection(), so the problem must lie either in Commons HttpClient or, 
more likely, Ivy's org.apache.ivy.util.url.HttpClientHandler.    Something that 
looks mildly suspicious (although perhaps is correct) is:

            if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
                Message.error("Your proxy requires authentication.");

You should run Ant with verbose logging enabled for Ivy tasks and look to see 
that the proxy configuration is at least being picked up by HttpClientHandler 
properly.

These notes are relevant of course, although probably not too helpful:
http://ant.apache.org/manual/install.html#proxy


> Ivy:retrieve fails through proxy server
> ---------------------------------------
>
>                 Key: IVY-529
>                 URL: https://issues.apache.org/jira/browse/IVY-529
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.0.0-alpha-1
>         Environment: Win XP, Ant 1.6.5, Java 5.  
>            Reporter: Nigel Charman
>             Fix For: 2.0
>
>
> I'm working at a site that connects to the net using a proxy server that 
> requires authentication.
> Our ant script uses the setproxy task to set the proxy details.  Calling the 
> ivy:retrieve task after setproxy results in the error:
>    [ivy:retrieve] :: problems summary ::
>    [ivy:retrieve] :::: WARNINGS
>    [ivy:retrieve]  Your proxy requires authentication.
>    [ivy:retrieve]  Your proxy requires authentication.
>    [ivy:retrieve]          module not found: [ commons-lang | commons-lang | 
> 2.1 ]
> However, there is a workaround.  Calling the get task before ivy:retrieve 
> fixes the problem.
> It appears that get must be doing something with the proxy details that 
> ivy:retrieve is not.  Please can ivy:retrieve be updated to perform the 
> authentication magic that get is doing?
> I have managed to reproduce this with the hello ivy example.  The failing Ant 
> Script contains:
>     <target name="proxy">
>             <property name="proxy.host" value="proxy.myorg.com"/>
>             <property name="proxy.port" value="8080"/>
>                 <input message="Please enter proxy username" 
> addproperty="proxy.user" />
>                 <input message="Please enter proxy password - NOTE: CLEAR 
> TEXT" addproperty="proxy.pass"/>
>             <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" 
> proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
>       </target>
>     <!-- =================================
>           target: resolve
>          ================================= -->
>     <target name="resolve" depends="proxy" description="--> retreive 
> dependencies with ivy">
>         <ivy:retrieve/>
>     </target>
> which produces the output
>     resolve:
>     [ivy:retrieve] :: Ivy 2.0.0-alpha-1-incubating - 20070416155158 :: 
>     http://incubator.apache.org/ivy/ ::
>     [ivy:retrieve] no settings file found, using default...
>     [ivy:retrieve] :: loading settings :: url = 
> jar:file:/C:/Program%20Files/Ant/lib/ivy-2.0.0-alpha-1-incubating.jar!/org/apache/ivy/core/settings/ivysettings.xml
>     [ivy:retrieve] :: resolving dependencies :: [ apache | hello-ivy | [EMAIL 
> PROTECTED] ]
>     [ivy:retrieve]  confs: [default]
>     [ivy:retrieve] :: resolution report ::
>      ---------------------------------------------------------------------
>       |                  |            modules            ||   artifacts  |
>       |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
>      ---------------------------------------------------------------------
>       |      default     |   1   |   0   |   0   |   0   ||   0   |   0  
>       |
>      ---------------------------------------------------------------------
>     [ivy:retrieve]
>     [ivy:retrieve] :: problems summary ::
>     [ivy:retrieve] :::: WARNINGS
>     [ivy:retrieve]  Your proxy requires authentication.
>     [ivy:retrieve]  Your proxy requires authentication.
>     [ivy:retrieve]          module not found: [ commons-lang | commons-lang | 
> 2.1 ]
>     [ivy:retrieve]  ==== local: tried
>     [ivy:retrieve]    C:\Documents and 
> Settings\charmann\.ivy/local/commons-lang/commons-lang/2.1/ivys/ivy.xml
>     [ivy:retrieve]    -- artifact [ commons-lang | commons-lang | 2.1 
> ]/commons-lang.jar[jar]:
>     [ivy:retrieve]    C:\Documents and 
> Settings\charmann\.ivy/local/commons-lang/commons-lang/2.1/jars/commons-lang.jar
>     [ivy:retrieve]  ==== shared: tried [ivy:retrieve]    C:\Documents and 
> Settings\charmann\.ivy/shared/commons-lang/commons-lang/2.1/ivys/ivy.xml
>     [ivy:retrieve]    -- artifact [ commons-lang | commons-lang | 2.1 
> ]/commons-lang.jar[jar]:
>     [ivy:retrieve]    C:\Documents and 
> Settings\charmann\.ivy/shared/commons-lang/commons-lang/2.1/jars/commons-lang.jar
>     [ivy:retrieve]  ==== public: tried[ivy:retrieve] 
> http://repo1.maven.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1.pom
>     [ivy:retrieve]    -- artifact [ commons-lang | commons-lang | 2.1 
> ]/commons-lang.jar[jar]:
>     [ivy:retrieve] 
> http://repo1.maven.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
>     [ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
>     [ivy:retrieve]          ::          UNRESOLVED DEPENDENCIES         ::
>     [ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
>     [ivy:retrieve]          :: [ commons-lang | commons-lang | 2.1 ]: not 
> found
>     [ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
>     [ivy:retrieve]
>     [ivy:retrieve]
>     [ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
>     BUILD FAILED
> Changing the ant script to include a get task fixes the problem:
>         <target name="proxy">
>             <property name="proxy.host" value="proxy.myorg.com"/>
>             <property name="proxy.port" value="8080"/>
>                 <input message="Please enter proxy username" 
> addproperty="proxy.user" />
>                 <input message="Please enter proxy password - NOTE: CLEAR 
> TEXT" addproperty="proxy.pass"/>
>             <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" 
> proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
>             <get src="http://www.google.co.nz"; dest="temp.html" 
> usetimestamp="true"/>
>           </target>
>  
>     <!-- ================================= 
>           target: resolve 
>          ================================= -->
>     <target name="resolve" depends="proxy" description="--> retreive 
> dependencies with ivy">
>         <ivy:retrieve/>
>     </target> 
> with the following output:
>     resolve:
>     [ivy:retrieve] :: Ivy 2.0.0-alpha-1-incubating - 20070416155158 :: 
> http://incubator.apache.org/ivy/ ::
>     [ivy:retrieve] no settings file found, using default...
>     [ivy:retrieve] :: loading settings :: url = 
> jar:file:/C:/Program%20Files/Ant/lib/ivy-2.0.0-alpha-1-incubating.jar!/org/apache/ivy/core/settings/ivysettings.xml
>     [ivy:retrieve] :: resolving dependencies :: [ apache | hello-ivy | [EMAIL 
> PROTECTED] ]
>     [ivy:retrieve]  confs: [default]
>     [ivy:retrieve]  found [ commons-lang | commons-lang | 2.1 ] in public
>     [ivy:retrieve] downloading 
> http://repo1.maven.org/maven2/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
>  ...
>     [ivy:retrieve] ..................
>     [ivy:retrieve] .................................... (202kB)
>     [ivy:retrieve] .. (0kB)
>     [ivy:retrieve]  [SUCCESSFUL ] [ commons-lang | commons-lang | 2.1 
> ]/commons-lang.jar[jar] (6923ms)
>     [ivy:retrieve] :: resolution report ::
>      ---------------------------------------------------------------------
>         |                  |            modules            ||   artifacts  |
>         |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
>      ---------------------------------------------------------------------
>         |      default     |   1   |   1   |   0   |   0   ||   1   |   1  |
>      ---------------------------------------------------------------------
>     [ivy:retrieve] :: retrieving :: [ apache | hello-ivy ]
>     [ivy:retrieve]  confs: [default]
>     [ivy:retrieve]  1 artifacts copied, 0 already retrieved
>     run:
>          [java] standard message : hello ivy !
>          [java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
>     BUILD SUCCESSFUL

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to