Hi Folks,
I am new to Apache Ivy and I am using it to manage dependency in one of my
ant projects. All I want is to retrieve a jar from a custom URL (Bitbucket)
which requires Basic Authentication. However, I am getting
NullPointerException when I am trying to retrieve the jar with version
*2.5.1*.
*java.lang.NullPointerException at
org.apache.ivy.util.url.HttpClientHandler.getURLInfo(HttpClientHandler.java:243)*
I don't get NPE with *2.4.0* version of ivy but it does not send
credentials in the header. Any pointers/help will be greatly appreciated. I
have attached the simple example files here along with log files of both
the versions to reproduce the issue. Ant version is *1.10.7* for me.
[image: image.png]
<project name="miniMAKS" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="ivy.cache.dir" value="${user.home}/.ivy2/cache"/>
<property name="ivy.settings.file" value="${basedir}/ivysettings.xml"/>
<property environment="env" />
<property name="lib.dir" location="lib" />
<property name="ivy.home" value="${env.IVY_HOME}" />
<property name="lib.nonapp" location="lib-non-app" />
<property name="build.dir" location="build" />
<property name="basedir" location="" />
<target name="init-ivy" description="Sets up Ivy">
<echo message="IVY_HOME=${ivy.home}" />
<path id="ivy.lib.path">
<fileset dir="${ivy.home}" includes="**/*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:settings file="${ivy.settings.file}">
<credentials host="api.bitbucket.org" realm="Bitbucket.org HTTP" username="username" passwd="password"/>
<credentials host="ivytry.free.beeceptor.com" realm="Basic" username="username" passwd="password"/>
</ivy:settings>
</target>
<target name="retrieve" depends="init-ivy" description="Retrieves the dependencies using Ivy">
<ivy:retrieve pattern="lib-non-app-ivy/[conf]/[artifact]-[revision].[ext]" conf="bb"/>
</target>
</project>
<ivysettings>
<settings defaultResolver="default-resolvers" defaultConflictManager="all" httpRequestMethod="GET"/>
<credentials host="api.bitbucket.org" realm="Bitbucket.org HTTP" username="username" passwd="password"/>
<credentials host="ivytry.free.beeceptor.com" realm="Basic" username="username" passwd="password"/>
<resolvers>
<chain name="default-resolvers">
<url name="bitbucket" m2compatible="false" checksums="">
<artifact pattern="https://ivytry.free.beeceptor.com/[artifact]-[revision].[ext]" />
<!-- <artifact pattern="https://api.bitbucket.org/2.0/repositories/example/example/downloads/[artifact]-[revision].[ext]"/>-->
</url>
</chain>
</resolvers>
<caches defaultCacheDir="${user.home}/.ivy2/cache" />
</ivysettings>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="org.example" module="ivytry" />
<configurations defaultconfmapping="bb->*;*->master">
<conf name="bb" visibility="public" ></conf>
</configurations>
<dependencies defaultconf="compile">
<dependency conf="bb" name="test" rev="1.0">
</dependency>
</dependencies>
</ivy-module>