Skip to content
Browse files

#370: prepare build for uploading artifacts to maven central

  • Loading branch information...
1 parent ad05eaf commit 668e9f60199230a3542ffe559b0b29cd048a7032 @jbellmann committed
Showing with 175 additions and 32 deletions.
  1. +2 −1 build.properties
  2. +144 −31 build.xml
  3. BIN lib/maven-ant-tasks-2.1.3.jar
  4. +29 −0 pom.xml
View
3 build.properties
@@ -34,4 +34,5 @@ tomcat.manager.password=tomcat
tomcat.context=/voldemort
## Release
-curr.release=0.90.1
+#curr.release=0.90.1
+curr.release=0.0.1-test
View
175 build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<project name="voldemort" basedir="." default="all">
+<project name="voldemort" basedir="." default="all" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property file="build.properties" />
<property name="name" value="voldemort" />
@@ -8,6 +8,18 @@
<property name="author" value="Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao" />
<property environment="env" />
+ <!-- configure maven-ant-tasks for upload to maven-central -->
+ <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
+
+ <!-- define maven snapshots and staging repository id and url -->
+ <property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
+ <property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
+ <property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
+ <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
+
+
+
<path id="main-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
@@ -18,12 +30,12 @@
<!-- set the build number based on environment variable, otherwise blank -->
<property environment="env" description="System environment variables (including those set by Hudson)"/>
<condition property="curr.release.snapshot" value="${curr.release}-snapshot-${env.BUILD_NUMBER}" else="${curr.release}">
- <and>
- <isset property="env.BUILD_NUMBER" />
- <not>
- <equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
- </not>
- </and>
+ <and>
+ <isset property="env.BUILD_NUMBER" />
+ <not>
+ <equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
+ </not>
+ </and>
</condition>
<path id="contrib-classpath">
@@ -116,7 +128,7 @@
<target name="protobuff" description="Generate source files from .proto files">
<pathconvert property="proto.sources" pathsep=" ">
<path id="proto-files">
- <fileset dir="${protobuff.dir}" />
+ <fileset dir="${protobuff.dir}" />
</path>
</pathconvert>
@@ -152,6 +164,19 @@
</jar>
</target>
+ <target name="allsrcjar" description="Build source jar file">
+ <mkdir dir="${dist.dir}" />
+ <jar destfile="${dist.dir}/${name}-${curr.release}-all-src.jar">
+ <fileset dir="${java.dir}">
+ <include name="**/*.java" />
+ <include name="**/*.xsd"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.html"/>
+ <include name="**/*.vm"/>
+ </fileset>
+ </jar>
+ </target>
+
<target name="alljar" depends="build, contrib-build" description="Build a jar file that includes all contrib code.">
<jar destfile="${dist.dir}/${name}-${curr.release}-all.jar">
<fileset dir="${classes.dir}">
@@ -316,24 +341,24 @@
<macrodef name="create-release-artifacts">
<attribute name="version" />
<sequential>
- <antcall target="all"/>
- <zip destfile="${dist.dir}/${name}-@{version}.zip">
- <zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
- <zipfileset dir="." prefix="voldemort-@{version}" includes="**">
- <exclude name="${dist.dir}/*classes"/>
- <exclude name="bin/*"/>
- <exclude name=".git*/**"/>
- </zipfileset>
- </zip>
- <tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
- <tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
- <tarfileset dir="." prefix="voldemort-@{version}" includes="**">
- <exclude name="${dist.dir}/*classes"/>
- <exclude name="${dist.dir}/*.zip"/>
- <exclude name="bin/*"/>
- <exclude name=".git*/**"/>
- </tarfileset>
- </tar>
+ <antcall target="all"/>
+ <zip destfile="${dist.dir}/${name}-@{version}.zip">
+ <zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
+ <zipfileset dir="." prefix="voldemort-@{version}" includes="**">
+ <exclude name="${dist.dir}/*classes"/>
+ <exclude name="bin/*"/>
+ <exclude name=".git*/**"/>
+ </zipfileset>
+ </zip>
+ <tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
+ <tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
+ <tarfileset dir="." prefix="voldemort-@{version}" includes="**">
+ <exclude name="${dist.dir}/*classes"/>
+ <exclude name="${dist.dir}/*.zip"/>
+ <exclude name="bin/*"/>
+ <exclude name=".git*/**"/>
+ </tarfileset>
+ </tar>
</sequential>
</macrodef>
@@ -386,7 +411,7 @@
<report todir="${testhtml.dir}" format="frames" />
</junitreport>
</target>
-
+
<target name="junit-test" depends="build, buildtest, contrib-jar" description="Run single junit test with -Dtest.name=">
<junit printsummary="yes" showoutput="true" maxmemory="1024m">
<classpath refid="contrib-test-classpath" />
@@ -434,10 +459,98 @@
</target>
<target name="undeploy" description="Undeploy application">
- <undeploy url="${tomcat.manager.url}"
- username="${tomcat.manager.username}"
- password="${tomcat.manager.password}"
- path="${tomcat.context}"/>
+ <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${tomcat.context}" />
+ </target>
+
+
+
+
+
+
+
+ <!-- UPLOAD TO SONATYPE SNAPSHOT REPOSITORY -->
+ <target name="uploadSnapshots" depends="alljar, allsrcjar, docs" description="deploy snapshot version to Maven snapshot repository">
+ <!-- prepare pom.xml -->
+ <copy file="pom.xml" tofile="${dist.dir}/pom.xml"/>
+ <replace file="${dist.dir}/pom.xml" token="@@@voldemort.version@@@" value="${curr.release}-SNAPSHOT"/>
+
+ <!-- package javadoc in a jar for upload -->
+ <jar destfile="${dist.dir}/${name}-${curr.release}-all-docs.jar">
+ <fileset dir="${javadoc.dir}/all"/>
+ </jar>
+
+ <!-- deploy the main artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
+ <arg value="-Durl=${maven-snapshots-repository-url}" />
+ <arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all.jar" />
+ </artifact:mvn>
+
+ <!-- deploy the sources artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
+ <arg value="-Durl=${maven-snapshots-repository-url}" />
+ <arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all-src.jar" />
+ <arg value="-Dclassifier=sources" />
+ </artifact:mvn>
+
+ <!-- deploy the javadoc artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
+ <arg value="-Durl=${maven-snapshots-repository-url}" />
+ <arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all-docs.jar" />
+ <arg value="-Dclassifier=javadoc" />
+ </artifact:mvn>
+ </target>
+
+ <!-- UPLOAD TO SONATYPE OSS STAGEING REPOSITORY -->
+ <target name="stageReleases" depends="alljar, allsrcjar, docs" description="deploy release version to Maven staging repository">
+ <!-- prepare pom.xml -->
+ <copy file="pom.xml" tofile="${dist.dir}/pom.xml"/>
+ <replace file="${dist.dir}/pom.xml" token="@@@voldemort.version@@@" value="${curr.release}"/>
+
+ <!-- package javadoc in a jar for upload -->
+ <jar destfile="${dist.dir}/${name}-${curr.release}-all-docs.jar">
+ <fileset dir="${javadoc.dir}/all"/>
+ </jar>
+
+ <!-- sign and deploy the main artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${maven-staging-repository-url}" />
+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all.jar" />
+ <arg value="-Pgpg" />
+ </artifact:mvn>
+
+ <!-- sign and deploy the sources artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${maven-staging-repository-url}" />
+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all-src.jar" />
+ <arg value="-Dclassifier=sources" />
+ <arg value="-Pgpg" />
+ </artifact:mvn>
+
+ <!-- sign and deploy the javadoc artifact -->
+ <artifact:mvn>
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${maven-staging-repository-url}" />
+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
+ <arg value="-DpomFile=${dist.dir}/pom.xml" />
+ <arg value="-Dfile=${dist.dir}/${name}-${curr.release}-all-docs.jar" />
+ <arg value="-Dclassifier=javadoc" />
+ <arg value="-Pgpg" />
+ </artifact:mvn>
</target>
</project>
View
BIN lib/maven-ant-tasks-2.1.3.jar
Binary file not shown.
View
29 pom.xml
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>voldemort</groupId>
+ <artifactId>voldemort-all</artifactId>
+ <version>@@@voldemort.version@@@</version>
+ <packaging>jar</packaging>
+ <name>voldemort</name>
+ <description>Voldemort - Key Value Store</description>
+ <url>http://project-voldemort.com/</url>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <url>https://github.com/voldemort/voldemort</url>
+ <connection>scm:git:git://github.com/voldemort/voldemort.git</connection>
+ <developerConnection>scm:git:git://github.com/voldemort/voldemort.git</developerConnection>
+ </scm>
+
+ <issueManagement>
+ <system>GoogleCode Issue Tracking</system>
+ <url>http://code.google.com/p/project-voldemort/issues</url>
+ </issueManagement>
+</project>

0 comments on commit 668e9f6

Please sign in to comment.
Something went wrong with that request. Please try again.