java - Travis CI can't find Ivy jarfile -


i'm new java , travis ci, , running error configuring project. i'm using ant build, , ivy manage dependencies. ant build downloads ivy jarfile directly if it's not found locally. works fine on machine, fails when push travis.

the puzzling thing: looks downloads jar , puts in /home/travis/.ant/lib/ during bootstrap-ivy task, fails find in resolve task follows. idea what's going on? full error, ant buildfile, , .travis.yml included below.

here's full travis error:

using worker: worker-linux-3-1.bb.travis-ci.org:travis-linux-13 git.1 $ git clone --depth=50 --branch=master git://github.com/ecmendenhall/java-ttt.git ecmendenhall/java-ttt cloning 'ecmendenhall/java-ttt'... remote: counting objects: 613, done. remote: compressing objects: 100% (345/345), done. remote: total 613 (delta 325), reused 421 (delta 133) receiving objects: 100% (613/613), 102.29 kib, done. resolving deltas: 100% (325/325), done. $ cd ecmendenhall/java-ttt git.2 $ git checkout -qf 3a5201cc7e850d7cbad69712fce28a36c86ea6d1 $ jdk_switcher use oraclejdk7 switching oracle jdk7 (java-7-oracle), java_home set /usr/lib/jvm/java-7-oracle update-alternatives: error: no alternatives apt. update-alternatives: error: no alternatives mozilla-javaplugin.so. update-alternatives: error: no alternatives apt. $ java -version java version "1.7.0_17" java(tm) se runtime environment (build 1.7.0_17-b02) java hotspot(tm) 64-bit server vm (build 23.7-b01, mixed mode) $ javac -version javac 1.7.0_17 $ ant resolve buildfile: /home/travis/build/ecmendenhall/java-ttt/build.xml     [mkdir] created dir: /home/travis/build/ecmendenhall/java-ttt/lib check-ivy:      [echo] checking ivy .jar in local directories. bootstrap-ivy:      [echo] bootstrapping ivy installation.     [mkdir] created dir: /home/travis/.ant/lib       [get] getting: http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar       [get] to: /home/travis/.ant/lib/ivy.jar resolve:      [echo] resolving project dependencies. build failed /home/travis/build/ecmendenhall/java-ttt/build.xml:52: problem: failed create task or type antlib:org.apache.ivy.ant:retrieve cause: name undefined. action: check spelling. action: check custom tasks/types have been declared. action: check <presetdef>/<macrodef> declarations have taken place. no types or tasks have been defined in namespace yet appears antlib declaration.  action: check implementing library exists in 1 of:         -/usr/share/ant/lib         -/home/travis/.ant/lib         -a directory added on command line -lib argument total time: 3 seconds command "ant resolve" failed , exited 1 during install. build has been stopped. 

here's ant buildfile:

<?xml version="1.0" encoding="utf-8"?> <project name="tictactoe" basedir="." default="jar" xmlns:ivy="antlib:org.apache.ivy.ant">     <description>builds tictactoe command line application , associated tests.</description>      <!-- source , build directory defaults -->     <property name="src.dir" value="src"/>     <property name="resources.dir" value="resources"/>      <property name="build.dir" value="build"/>     <property name="classes.dir" value="${build.dir}/classes"/>     <property name="jar.dir" value="${build.dir}/jar"/>      <property name="main-class" value="com.cmendenhall.main"/>      <mkdir dir="lib" />     <property name="lib.dir" value="lib"/>     <property name="test.dir" value="test" />      <path id="classpath">         <fileset dir="${lib.dir}" includes="**/*.jar"/>     </path>      <path id="classpath.test">         <fileset dir="${lib.dir}" includes="**/*.jar"/>         <pathelement location="${classes.dir}" />         <pathelement location="${resources.dir}" />     </path>      <path id="application" location="${jar.dir}/${ant.project.name}.jar"/>      <!-- automatically download ivy -->     <property name="ivy.jar.dir" value="${user.home}/.ant/lib" />     <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />      <target name="check-ivy" unless="intern-ivy.jar.exists" description="check if ivy .jar installed.">         <echo message="checking ivy .jar in local directories." />         <available property="intern-ivy.jar.exists" file="${ivy.jar.file}"/>     </target>      <target name="bootstrap-ivy"             description="installs ivy jar before downloading dependencies."             unless="intern-ivy.jar.exists"             depends="check-ivy">         <echo message="bootstrapping ivy installation." />         <mkdir dir="${user.home}/.ant/lib"/>         <get dest="${user.home}/.ant/lib/ivy.jar"              src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>         <mkdir dir="/usr/share/ant/lib" />         <get dest="/usr/share/ant/lib/ivy.jar"              src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar" />     </target>      <target name="resolve" description="retrieve dependencies ivy." depends="check-ivy, bootstrap-ivy">         <echo message="resolving project dependencies." />         <ivy:retrieve />     </target>      <target name="clean" description="cleans automatically generated files , directories.">         <echo message="cleaning build directory." />         <delete dir="${build.dir}"/>     </target>      <target name="compile" depends="resolve" description="compiles project.">         <echo message="compiling project." />         <mkdir dir="${classes.dir}"/>         <javac includeantruntime="false" debug="true" srcdir="${src.dir}" destdir="${classes.dir}" >             <classpath refid="classpath" />         </javac>     </target>      <target name="compile-tests" depends="resolve" description="compiles junit tests." >         <echo message="compiling junit tests." />         <javac includeantruntime="false" debug="true" srcdir="${test.dir}" destdir="${classes.dir}" >             <classpath refid="classpath" />         </javac>     </target>      <target name="jar" depends="compile" description="packages project .jar file.">         <echo message="packaging project .jar file." />         <mkdir dir="${jar.dir}"/>         <jar destfile="${jar.dir}/${ant.project.name}.jar">             <manifest>                 <attribute name="main-class" value="${main-class}"/>             </manifest>             <fileset dir="${classes.dir}">                 <include name="**/*.class" />             </fileset>             <fileset dir="${resources.dir}">                 <include name="**/*.properties" />             </fileset>         </jar>     </target>      <property name="junitpath" refid="classpath.test" />       <target name="test" depends="compile, compile-tests" description="runs junit tests.">         <echo message="running junit tests." />         <junit printsummary="on" haltonfailure="yes" failureproperty="test.failure">             <jvmarg value="-dfile.encoding=utf-8:-xx:-usesplitverifier" />             <formatter type="brief" usefile="false" />             <classpath>                 <path refid="classpath.test"/>             </classpath>              <batchtest fork="on">                 <fileset id="matchedtests" dir="${classes.dir}">                     <include name="**/*test.class"/>                     <exclude name="**/tictactoetest.class" />                 </fileset>             </batchtest>         </junit>     </target>      <target name="clean-build" depends="clean, jar" description="cleans output directory , builds .jar.">         <echo message="cleaning build directory , rebuilding .jar." />     </target>      <target name="build-all" depends="clean, jar, test" description="cleans output directory, retrieves dependencies, builds , packages project , tests.">         <echo message="finishing build." />     </target>  </project> 

and here's .travis.yml:

language: java install: ant resolve jdk:   - oraclejdk7   - openjdk7   - openjdk6 

update: here's solution worked me, advice below.

i replaced custom bootstrap-ivy task download-ivy , init-ivy tasks recommended in official docs:

    <property name="ivy.install.version" value="2.1.0-rc2" />     <condition property="ivy.home" value="${env.ivy_home}">       <isset property="env.ivy_home" />     </condition>     <property name="ivy.home" value="${user.home}/.ant" />     <property name="ivy.jar.dir" value="${ivy.home}/lib" />     <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />      <target name="download-ivy" unless="offline">          <mkdir dir="${ivy.jar.dir}"/>         <!-- download ivy web site can used without special installation -->         <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"               dest="${ivy.jar.file}" usetimestamp="true"/>     </target>      <target name="init-ivy" depends="download-ivy">       <!-- try load ivy here ivy home, in case user has not dropped               ant's lib dir (note latter copy take precedence).               not fail long local lib dir exists (it may empty) ,               ivy in @ least 1 of ant's lib dir or local lib dir. -->         <path id="ivy.lib.path">             <fileset dir="${ivy.jar.dir}" includes="*.jar"/>          </path>         <taskdef resource="org/apache/ivy/ant/antlib.xml"                  uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>     </target> 

i added before_install step .travis.yml, runs ant init-ivy before trying resolve dependencies (here docs on travis build cycle):

language: java before_install: ant init-ivy install: ant resolve jdk:   - oraclejdk7   - openjdk7   - openjdk6 

now everything's working!

this related way ant loading jars .ant/lib. folder being looked @ boot of ant, , if jar found there added core classloader. here .ant/lib being populated while executing build, way late.

two choices resolve this:


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -