THRIFT-931. java: Use log4j for Java tests

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1001967 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/build.xml b/lib/java/build.xml
index a378215..4975068 100644
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -55,15 +55,14 @@
   
   <!-- TODO: Get the appropriate tokens / URL for upload -->  
   <property name="apache.snapshot.repository" value="https://repository.apache.org/content/repositories/snapshots" />
-  
+ 
   <path id="compile.classpath">
-    <fileset dir="${ivy.lib.dir}">
-      <include name="**/*.jar" />
-    </fileset>
+    <path refid="ivy.compile.classpath" />
   </path>
 
   <path id="test.classpath">
     <path refid="compile.classpath" />
+    <path refid="ivy.test.classpath" />
     <pathelement path="${env.CLASSPATH}" />
     <pathelement location="build/test" />
     <pathelement location="${jar.file}" />
@@ -118,6 +117,8 @@
 
   <target name="resolve" depends="ivy-init-antlib" description="retrieve dependencies with ivy" unless="noivy">
     <ivy:retrieve />
+    <ivy:cachepath pathid="ivy.compile.classpath" conf="compile" />
+    <ivy:cachepath pathid="ivy.test.classpath" conf="test" />
   </target>
 
   <target name="compile" depends="init,resolve">
@@ -172,6 +173,9 @@
     <javac debug="true" srcdir="${gen}" destdir="${build.test}" classpathref="test.classpath" />
     <javac debug="true" srcdir="${genbean}" destdir="${build.test}" classpathref="test.classpath" />
     <javac debug="true" srcdir="${src.test}" destdir="${build.test}" classpathref="test.classpath" />
+    <copy todir="${build.test}">
+      <fileset dir="${src.test}" includes="log4j.properties" />
+    </copy>
   </target>
 
   <property name="build.test" location="${build.dir}/test"/>
diff --git a/lib/java/ivy.xml b/lib/java/ivy.xml
index 902e50d..07fb3b3 100644
--- a/lib/java/ivy.xml
+++ b/lib/java/ivy.xml
@@ -21,11 +21,15 @@
       <repository name="apache repository" url="http://incubator.apache.org/thrift/" />
       <description homepage="http://incubator.apache.org/thrift/" />
     </info>
+    <configurations defaultconfmapping="compile">
+      <conf name="compile" />
+      <conf name="test" extends="compile" visibility="private" />
+    </configurations>
     <dependencies>
        <dependency org="org.slf4j" name="slf4j-api" rev="1.5.8" conf="* -> *,!sources,!javadoc"/>
-       <dependency org="org.slf4j" name="slf4j-simple" rev="1.5.8" conf="* -> *,!sources,!javadoc"/>
+       <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.8" conf="test -> *,!sources,!javadoc"/>
        <dependency org="commons-lang" name="commons-lang" rev="2.5" conf="* -> *,!sources,!javadoc"/>
-       <dependency org="junit" name="junit" rev="4.4" conf="* -> *,!sources,!javadoc"/>
+       <dependency org="junit" name="junit" rev="4.4" conf="test -> *,!sources,!javadoc"/>
        <dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="* -> *,!sources,!javadoc"/>
     </dependencies>
 </ivy-module>