Thrift-363: Maven Deploy
Patch: jfarrell
Client lib: java

Adding the ability to publish the java client library as artifacts to the apache maven repository.     

Usage: ant -Drelease=true publish
Note: You must have a gpg key setup and push it to pgp.mit.edu and
  have a ~/.m2/settings.xml file containing your apache and gpg information.
  Thrift-1114 will help make this file more secure or unnecessary.

  <settings>
    <servers>
      <server>
        <id>apache.releases.https</id>
        <username>@APACHE_USERNAME@</username>
        <password>@APACHE_PASSWORD@</password>
      </server>
    </servers>
    <profiles>
      <profile>
        <id>gpg</id>
        <properties>
          <gpg.passphrase>@GPG_PASSPHRASE@</gpg.passphrase>
        </properties>
      </profile>
    </profiles>
  </settings>



git-svn-id: https://svn.apache.org/repos/asf/thrift/branches/0.6.x@1095216 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/build.xml b/lib/java/build.xml
index f626b37..cddf014 100644
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -18,83 +18,57 @@
  under the License.
  -->
 <project name="libthrift" default="dist" basedir="."
-  xmlns:ivy="antlib:org.apache.ivy.ant"
   xmlns:artifact="antlib:org.apache.maven.artifact.ant">
   
   <description>Thrift Build File</description>
   <property name="thrift.root" location="../../"/>
-  <property name="thrift.version" value="0.6.1"/>
-  <property name="thrift.groupid" value="org.apache.thrift"/>
   <property name="thrift.artifactid" value="libthrift"/>
-  
-  <property name="mvn.ant.task.version" value="2.1.1"/>
-  <property name="ivy.version" value="2.2.0"/>
-   
-  <!-- Local install locations -->
-  <property name="install.path" value="/usr/local/lib"/>
-  <property name="install.javadoc.path" value="${install.path}"/>
-  
-  <!-- Dependency download location -->
-  <property name="mvn.repo" value="http://repo1.maven.org/maven2"/>
-  <property name="apache.repo" value="https://repository.apache.org/content/repositories/releases"/>  
-  
-  <!-- Publish information-->
-  <property name="license" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
-  <property name="maven-repository-url" value="https://repository.apache.org/service/local/staging/deploy/maven2"/>
-  <property name="maven-repository-id" value="apache.releases.https"/>  
-  
+
+  <!-- Include the base properties file -->
+  <property file="${basedir}/build.properties" />
+
   <property environment="env"/>
-  
+
   <condition property="version" value="${thrift.version}">
     <isset property="release"/>
   </condition>
-  <property name="version" value="${thrift.version}-snapshot"/>  
-  
+  <property name="version" value="${thrift.version}-snapshot"/> 
+
   <property name="final.name" value="${thrift.artifactid}-${version}"/>
-  
-  <property name="gen" location="gen-java"/>
-  <property name="genbean" location="gen-javabean"/>
-   
+
   <property name="src" location="${basedir}/src"/>
   <property name="build.dir" location="${basedir}/build"/>
   <property name="build.lib.dir" location="${build.dir}/lib"/>
   <property name="build.tools.dir" location="${build.dir}/tools"/>
   <property name="src.test" location="test"/>
+  <property name="javadoc.dir" location="${build.dir}/javadoc"/>
   <property name="build.test.dir" location="${build.dir}/test"/>
   <property name="test.thrift.home" location="${thrift.root}/test"/>
-  
-  <property name="javadoc.dir" location="${build.dir}/javadoc"/>
-  
+
+  <property name="gen" location="gen-java"/>
+  <property name="genbean" location="gen-javabean"/>
+
   <property name="jar.file" location="${build.dir}/${final.name}.jar"/>
   <property name="test.jar.file" location="${build.dir}/${final.name}-test.jar"/>
   <property name="javadoc.jar.file" location="${build.dir}/${final.name}-javadoc.jar"/>
   <property name="source.tar.gz" location="${build.dir}/${final.name}-src.tar.gz"/>
-  
+
   <!-- Junit properties -->
   <property name="test.junit.output.format" value="plain"/>
   <property name="test.timeout" value="2000000"/>
   <property name="test.src.dir" location="${basedir}/test"/>
   <property name="test.log.dir" value="${build.test.dir}/log"/>
-  <property name="test.port" value="9090"/>  
-  
-  <!-- iv properties -->  
-  <property name="ivy.repo.url" value="${mvn.repo}/org/apache/ivy/ivy/${ivy.version}/"/>
-  <property name="ivy.jar" value="${build.tools.dir}/ivy-${ivy.version}.jar"/>  
-  
+  <property name="test.port" value="9090"/> 
+
   <!-- maven properties -->
-  <property name="mvn.ant.task.url" value="${mvn.repo}/org/apache/maven/maven-ant-tasks/${mvn.ant.task.version}"/>
-  <property name="mvn.ant.task.jar" location="${build.tools.dir}/maven-ant-tasks-${mvn.ant.task.version}.jar"/>
   <property name="pom.xml" location="${build.dir}/${final.name}.pom"/>
-  
-  <!-- custom override anything with a thrift-build.properties file in your home directory -->  
-  <property file="${user.home}/.thrift-build.properties"/>
-  
+
   <path id="compile.classpath">
     <fileset dir="${build.lib.dir}"> 
       <include name="**/*.jar"/>
     </fileset>
   </path>
-  
+
   <path id="test.classpath">
     <path refid="compile.classpath"/>
     <pathelement path="${env.CLASSPATH}"/>
@@ -102,12 +76,12 @@
     <pathelement location="${jar.file}"/>
     <pathelement location="${test.jar.file}"/>
   </path>
-  
-  <!-- Tasks -->  
-  <target name="init" depends="setup.init,ivy.init,mvn.init" unless="init.finished">
+
+  <!-- Tasks --> 
+  <target name="init" depends="setup.init,mvn.init" unless="init.finished">
     <property name="init.finished" value="true"/>
   </target>
-  
+
   <target name="setup.init">
     <tstamp/>
     <mkdir dir="${build.dir}"/>
@@ -115,38 +89,12 @@
     <mkdir dir="${build.tools.dir}"/>
     <mkdir dir="${build.test.dir}"/>
   </target>
-  
-  <target name="ivy.download" depends="setup.init" unless="ivy.found">
-    <get src="${ivy.repo.url}/ivy-${ivy.version}.jar" dest="${ivy.jar}" usetimestamp="true"/>
-  </target>
-  
-  <target name="ivy.check" description="check if ivy is in the classpath">
-    <condition property="ivy.found">
-      <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
-    </condition>
-  </target>
-  
-  <target name="ivy.init" depends="setup.init,ivy.check,ivy.download" unless="ivy.found">
-    <typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader">
-      <classpath>
-        <pathelement location="${ivy.jar}"/>
-      </classpath>
-    </typedef>
-    <fail>
-      <condition >
-        <not>
-          <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
-        </not>
-      </condition>
-      You need Apache Ivy 2.0 or later from ${ivy.repo.url}. It could not be loaded from ${ivy.jar}
-    </fail>
-  </target>
-  
+
   <target name="compile" depends="init">
     <javac srcdir="${src}" destdir="${build.dir}" source="1.5" target="1.5" 
     debug="true" classpathref="compile.classpath" includeantruntime="false"/>
   </target>
-  
+
   <target name="javadoc" depends="init">
     <javadoc sourcepath="${src}" destdir="${javadoc.dir}"
       version="true" windowtitle="Thrift Java API" doctitle="Thrift Java API"
@@ -158,7 +106,7 @@
       </manifest>
     </jar>
   </target>
-  
+
   <target name="dist" depends="compile">
     <mkdir dir="${build.dir}/META-INF"/>
     <copy file="${thrift.root}/LICENSE" tofile="${build.dir}/META-INF/LICENSE.txt"/>
@@ -176,11 +124,11 @@
       </fileset>
     </jar>
   </target>
-  
+
   <target name="pack.src">
     <tar destfile="${source.tar.gz}" basedir="${src}" compression="gzip"/>
   </target>
-  
+
   <target name="install" depends="dist,javadoc">
     <copy todir="${install.path}">
       <fileset dir="."><include name="*.jar"/></fileset>
@@ -191,13 +139,13 @@
       </fileset>
     </copy>
   </target>
-  
+
   <target name="clean">
     <delete dir="${build.dir}"/>
     <delete dir="${gen}"/>
     <delete dir="${genbean}"/>
   </target>
-  
+
   <target name="compile-test" description="Build the test suite classes" depends="generate,dist">
     <javac debug="true" srcdir="${gen}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false"/>
     <javac debug="true" srcdir="${genbean}" destdir="${build.test.dir}" classpathref="test.classpath" includeantruntime="false"/>
@@ -207,13 +155,13 @@
     </copy>
     <jar jarfile="${test.jar.file}" basedir="${build.test.dir}"/>
   </target>
-  
+
   <target name="junit-test" description="Run the JUnit test suite" depends="compile-test">
     <mkdir dir="${test.log.dir}"/>
     <junit printsummary="true" showoutput="${test.output}" timeout="${test.timeout}" 
-      haltonfailure="no" errorProperty="tests.failed" failureProperty="tests.failed"
+      haltonfailure="true" errorProperty="tests.failed" failureProperty="tests.failed"
       fork="true" forkmode="perTest" maxmemory="512m"
-      >
+    >
       <sysproperty key="build.test" value="${build.test.dir}"/>
       <sysproperty key="test.port" value="${test.port}"/>
       <sysproperty key="javax.net.ssl.trustStore" value="${src.test}/.truststore"/>
@@ -236,35 +184,35 @@
     </junit>
     <fail if="tests.failed">Tests failed!</fail>
   </target>
-  
+
   <target name="deprecated-test" description="Run the non-JUnit test suite" depends="compile-test">
     <java classname="org.apache.thrift.test.EqualityTest" classpathref="test.classpath" failonerror="true"/>
     <java classname="org.apache.thrift.test.JavaBeansTest" classpathref="test.classpath" failonerror="true"/>
   </target>
-  
+
   <target name="test" description="Run the full test suite" depends="junit-test,deprecated-test"/>
-  
+
   <target name="testclient" description="Run a test client" depends="compile-test">
     <java classname="org.apache.thrift.test.TestClient"
       classpathref="test.classpath" failonerror="true">
       <arg line="${testargs}"/>
     </java>
   </target>
-  
+
   <target name="testserver" description="Run a test server" depends="compile-test">
     <java classname="org.apache.thrift.test.TestServer"
       classpathref="test.classpath" failonerror="true">
       <arg line="${testargs}"/>
     </java>
   </target>
-  
+
   <target name="testnonblockingserver" description="Run a test nonblocking server" depends="compile-test">
     <java classname="org.apache.thrift.test.TestNonblockingServer"
       classpathref="test.classpath" failonerror="true">
       <arg line="${testargs}"/>
     </java>
   </target>
-  
+
   <target name="generate">
     <!-- Generate the thrift gen-java source -->
     <exec executable="../../compiler/cpp/thrift" failonerror="true">
@@ -280,25 +228,25 @@
       <arg line="--gen java:beans,nocamel ${test.thrift.home}/JavaBeansTest.thrift"/>
     </exec>
   </target>
-  
+
   <target name="mvn.ant.tasks.download" depends="setup.init" unless="mvn.ant.tasks.found">
-    <get src="${mvn.ant.task.url}/maven-ant-tasks-${mvn.ant.task.version}.jar" dest="${mvn.ant.task.jar}" usetimestamp="true"/>
+    <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/>
   </target>
-  
+
   <target name="mvn.ant.tasks.check">
     <condition property="mvn.ant.tasks.found">
       <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/>
     </condition>
-  </target>  
-  
+  </target> 
+
   <target name="mvn.init" depends="mvn.ant.tasks.download" unless="mvn.finished">
     <!-- Download mvn ant tasks, download dependencies, and setup pom file -->
-    <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${mvn.ant.task.jar}"/>
-    
+    <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${build.tools.dir}/${mvn.ant.task.jar}"/>
+
     <!-- remote repositories used to download dependencies from -->
     <artifact:remoteRepository id="central" url="${mvn.repo}"/>
     <artifact:remoteRepository id="apache" url="${apache.repo}"/>
-    
+
     <!-- Pom file information -->
     <artifact:pom id="pom" 
       groupId="${thrift.groupid}" 
@@ -308,13 +256,13 @@
       name="Apache Thrift"
       description="Thrift is a software framework for scalable cross-language services development."
       packaging="pom"
-      >
+    >
       <remoteRepository refid="central"/>
       <remoteRepository refid="apache"/>
       <license name="The Apache Software License, Version 2.0" url="${license}"/>
       <scm connection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/" 
-      developerConnection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/"
-      url="http://svn.apache.org/viewcvs.cgi/thrift"
+        developerConnection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/"
+        url="http://svn.apache.org/viewcvs.cgi/thrift"
       />
       <!-- Thrift Developers -->
       <developer id="mcslee" name="Mark Slee"/>
@@ -332,7 +280,8 @@
       <developer id="geechorama" name="Andrew McGeachie"/>
       <developer id="molinaro" name="Anthony Molinaro"/>
       <developer id="roger" name="Roger Meier"/>
-      
+      <developer id="jfarrell" name="Jake Farrell"/>
+
       <!-- Thrift dependencies list -->
       <dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.5.8"/>
       <dependency groupId="org.slf4j" artifactId="slf4j-log4j12" version="1.5.8"/>
@@ -341,22 +290,22 @@
       <dependency groupId="javax.servlet" artifactId="servlet-api" version="2.5"/>
       <dependency groupId="org.apache.httpcomponents" artifactId="httpclient" version="4.0.1"/>
     </artifact:pom>
-    
+
     <!-- Generate the pom file -->
     <artifact:writepom pomRefId="pom" file="${pom.xml}"/>
-    
+
     <!-- Download the dependencies -->
     <artifact:dependencies filesetId="build-dependency-jars" pomRefId="pom"/>
-    
+
     <!-- Copy the dependencies to the build/lib dir -->
     <copy todir="${build.dir}/lib">
       <fileset refid="build-dependency-jars"/>
       <mapper type="flatten"/>
     </copy>
-    
+
     <property name="mvn.finished" value="true"/>
   </target>
-  
+
   <macrodef name="signAndDeploy">
     <!-- Sign and deploy jars to apache repo -->
     <attribute name="file"/>
@@ -375,7 +324,7 @@
       </artifact:mvn>
     </sequential>
   </macrodef>
-  
+
   <target name="publish" depends="clean,init,test,dist,javadoc,pack.src">
     <!-- Compile, package, test and then send release to apache maven repo -->
     <!-- run with: ant -Drelease=true publish-->