Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

#370: prepare build for uploading artifacts to maven central #56

Open
wants to merge 1 commit into from

5 participants

@jbellmann

Hi,

one of your 'Fun-Projects' was to provide Voldemort artifacts from maven central. I prepared the build.xml, added the maven-ant-task.jar an pom.xml-template to make it should work.

But there is more to do on your side. Your 'Release-Manager' has to create an Account on Sonatype OSS and to create an 'Project-Request' on Sonatype OSS Jira. You can read the following well written documentation: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide

Or you can ask me for some help, if it is possible for me to help. Or if you have any further questions.

This pullrequest relates to:
http://code.google.com/p/project-voldemort/issues/detail?id=370

Cheers,
Jörg

@afeinberg
Collaborator

Thanks, I believe we have a sona type account already for the team. Will try this out and then merge this in.

@afeinberg afeinberg commented on the diff
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
@afeinberg Collaborator

Why are you setting it to 0.0.1-test?

I tried an upload with my own account, to the staging area. But does not work. Was an test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg afeinberg commented on the diff
build.xml
@@ -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>
@afeinberg Collaborator

Can you explain why this is done?

Are there any differences? Seems to me only the whitespace makes a different here. Maybe a result of 'autoformat' in the editor?

Same below on old line 119. Just indents 'fixed'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg afeinberg commented on the diff
build.xml
((16 lines not shown))
- <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">
@afeinberg Collaborator

Can you please fix the indentation here?

Do you think indentation is wrong? 'sequential' is an opening-element. So 'antcall', 'zip', 'tar' are chilldren and therefore indented. 'sequential' closes on line 362.
What dou you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg afeinberg commented on the diff
build.xml
@@ -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}" />
@afeinberg Collaborator

Please revert indentation back to the original, so the diff isn't there

I will try it. Do I have to create an new 'pull-request' when done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg afeinberg commented on the diff
build.xml
@@ -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>
+
+
@afeinberg Collaborator

Please remove the spaces

Same as comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg afeinberg commented on the diff
build.xml
((82 lines not shown))
+ <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" />
@afeinberg Collaborator

How would deployment work, e.g., where would I need to specify my username and password, provide the PGP key?

Please read:

https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-7c.DeploySnapshotsandStageReleaseswithAnt

but I would not configure a 'pgp-profile', so you should be prompted for your passphrase when the artifacts will be signed and uploaded.

then:

ant uploadSnapshots

ant stageReleases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@afeinberg
Collaborator

Hi,

I just added some comments.

I have an account ready for sonatype, would I now need to upload my GPG key in order to sign this, or will this be done at another level?

Thanks,

  • Alex
@afeinberg
Collaborator

Please let me know when you make the stylistic changes, and I'll give this a shot.

Thanks,

  • Alex
@abh1nay abh1nay was assigned
@miguel0afd

+1
It would be great if Voldemort were in Maven Central

@FelixGV
Collaborator

Hi,

I believe this probably won't work as we moved away from the ant build towards gradle instead. In any case, we need to clean up dependencies before Maven Central publishing can be achieved. I've started doing that here: #243

After that, we'll only need to figure out how to depend on bdb-je and then we can publish Voldemort artifacts to Maven Central (:

-F

@miguel0afd

Hi,

in any case, thanks for the work., I'll be around in order to find out when the goal is achieved ;-)

@FelixGV
Collaborator

FYI: All dependencies besides BDB-JE have been cleaned up. We need to test #247 before we are free from all checked in dependencies... We want to be careful because the BDB-JE upgrade might introduce performance regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
@afeinberg Collaborator

Why are you setting it to 0.0.1-test?

I tried an upload with my own account, to the staging area. But does not work. Was an test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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>
@afeinberg Collaborator

Can you explain why this is done?

Are there any differences? Seems to me only the whitespace makes a different here. Maybe a result of 'autoformat' in the editor?

Same below on old line 119. Just indents 'fixed'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <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">
@afeinberg Collaborator

Can you please fix the indentation here?

Do you think indentation is wrong? 'sequential' is an opening-element. So 'antcall', 'zip', 'tar' are chilldren and therefore indented. 'sequential' closes on line 362.
What dou you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <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}" />
@afeinberg Collaborator

Please revert indentation back to the original, so the diff isn't there

I will try it. Do I have to create an new 'pull-request' when done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ </target>
+
+
@afeinberg Collaborator

Please remove the spaces

Same as comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+
+
+
+
+ <!-- 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" />
@afeinberg Collaborator

How would deployment work, e.g., where would I need to specify my username and password, provide the PGP key?

Please read:

https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-7c.DeploySnapshotsandStageReleaseswithAnt

but I would not configure a 'pgp-profile', so you should be prompted for your passphrase when the artifacts will be signed and uploaded.

then:

ant uploadSnapshots

ant stageReleases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <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>
Something went wrong with that request. Please try again.