Permalink
Browse files

Attempt to make maven-dist work

  • Loading branch information...
ndw committed Mar 19, 2013
1 parent 80539f5 commit faf111bd500f77d3bb223bb84c6a9f82ae316182
Showing with 271 additions and 2 deletions.
  1. +106 −2 build.xml
  2. +55 −0 docs/maven-build.txt
  3. +110 −0 pom.xml
View
108 build.xml
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="calabash" default="default" basedir=".">
- <description>Builds the distribution jar because IntelliJ sucks at it</description>
+<project name="calabash" default="default" basedir="."
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+ <description>
+ Ant build script for XML Calabash.
+
+ Useful targets:
+
+ compile - compiles :-)
+ jar - makes the jar
+ dist - makes a distribution jar/zip (requires IzPack)
+ report - run the test suite and produce the report
+ </description>
<property file="resources/etc/vendor.properties"/>
<property file="resources/etc/version.properties"/>
@@ -42,6 +52,24 @@
<echo>Cannot find IzPack; request to build dist ignored.</echo>
</target>
+ <!-- define Maven coordinates -->
+ <property name="groupId" value="com.xmlcalabash" />
+ <property name="artifactId" value="xmlcalabash" />
+
+ <!-- define artifact names, which follow the convention of Maven -->
+ <property name="maven.dir" value="${dist.dir}/maven" />
+ <property name="maven-jar" value="${maven.dir}/${artifactId}-${version}.jar" />
+ <property name="maven-javadoc-jar" value="${maven.dir}/${artifactId}-${version}-javadoc.jar" />
+ <property name="maven-sources-jar" value="${maven.dir}/${artifactId}-${version}-sources.jar" />
+
+ <!-- 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="build.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
@@ -474,4 +502,80 @@ java -Xmx1024m -jar %INSTALL_PATH/calabash.jar "$@"
<javadoc sourcepath="src" destdir="${build.dir}/javadoc"
classpathref="build.classpath"/>
</target>
+
+ <target name="maven-dist" depends="init,compile-everything,javadoc"
+ description="generate Maven jars">
+ <!-- build the main artifact -->
+ <jar destfile="${maven-jar}">
+ <manifest>
+ <attribute name="Built-By" value="${built.by}"/>
+ <attribute name="Implementation-Vendor" value="${implementation.vendor}"/>
+ <attribute name="Implementation-Title" value="${implementation.title}"/>
+ <attribute name="Implementation-Version" value="${dist-version}"/>
+ <attribute name="Main-Class" value="com.xmlcalabash.drivers.Main"/>
+ <attribute name="Class-Path" value="${run.classpath}"/>
+ </manifest>
+
+ <fileset dir="${build.dir}"/>
+ </jar>
+
+ <!-- build the sources artifact -->
+ <jar jarfile="${maven-sources-jar}">
+ <fileset dir="src" />
+ </jar>
+
+ <!-- build the javadoc artifact -->
+ <jar jarfile="${maven-javadoc-jar}">
+ <fileset dir="${build.dir}/javadoc" />
+ </jar>
+
+ <!-- Update the version in the POM -->
+ <copy file="pom.xml" toFile="${maven.dir}/pom.xml">
+ <filterset>
+ <filter token="version" value="${version}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <target name="maven-stage" depends="maven-dist"
+ description="deploy release version to Maven staging repository">
+ <!-- sign and deploy the main artifact -->
+ <input message="Please enter your GPG passphrase:" addproperty="passphrase">
+ <handler type="secure"/>
+ </input>
+
+ <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=${maven.dir}/pom.xml" />
+ <arg value="-Dfile=${maven-jar}" />
+ <arg value="-Dgpg.passphrase=${passphrase}"/>
+ <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=${maven.dir}/pom.xml" />
+ <arg value="-Dfile=${maven-sources-jar}" />
+ <arg value="-Dclassifier=sources" />
+ <arg value="-Dgpg.passphrase=${passphrase}"/>
+ <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=${maven.dir}/pom.xml" />
+ <arg value="-Dfile=${maven-javadoc-jar}" />
+ <arg value="-Dclassifier=javadoc" />
+ <arg value="-Dgpg.passphrase=${passphrase}"/>
+ <arg value="-Pgpg" />
+ </artifact:mvn>
+ </target>
</project>
View
@@ -0,0 +1,55 @@
+This describes the steps necessary to release Calabash to the Maven
+Central repository.
+
+Initial setup
+=============
+
+Make sure you have GPG installed, and have distributed a key to the
+pool.sks-keyservers.net server
+
+ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys [your key ID]
+
+Go to the Sonatype docs:
+
+ https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
+
+Carry out these steps:
+
+ Section 2 - signing up for a Sonatype JIRA account
+ Section 3 - creating a JIRA ticket
+
+Download Ant Maven tasks from
+http://maven.apache.org/ant-tasks/download.html and put it into
+~/.ant/lib/.
+
+Create an XML file at ~/.m2/settings.xml
+
+ <settings>
+ <servers>
+ <server>
+ <id>sonatype-nexus-snapshots</id>
+ <username>your-username</username>
+ <password>your-password</password>
+ </server>
+ <server>
+ <id>sonatype-nexus-staging</id>
+ <username>your-username</username>
+ <password>your-password</password>
+ </server>
+ </servers>
+ <profiles>
+ </profiles>
+ </settings>
+
+Releasing to Maven
+==================
+
+Run "ant maven-stage" to build a release and deploy it to the Sonatype server.
+
+Go back to the Sonatype docs at
+
+ https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide.
+
+Carry out section 8 - release.
+
+For the first release, also carry out section 9 - activate Central Sync
View
110 pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.xmlcalabash</groupId>
+ <artifactId>xmlcalabash</artifactId>
+ <!-- This will be updated by Ant -->
+ <version>@version@</version>
+ <name>XML Calabash</name>
+ <description>XML Calabash - an implementation of XProc: An XML Pipeline Language</description>
+ <url>http://xmlcalabash.com/</url>
+ <packaging>jar</packaging>
+
+ <developers>
+ <developer>
+ <name>Norman Walsh</name>
+ <url>http://nwalsh.com/</url>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>Common Development and Distribution License (CDDL) version 1.0</name>
+ <url>http://www.opensource.org/licenses/cddl1.txt</url>
+ </license>
+ <license>
+ <name>GNU General Public License version 2+</name>
+ <url>http://www.gnu.org/licenses/gpl-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:git:git@github.com:ndw/xmlcalabash1.git</connection>
+ <url>https://github.com/ndw/xmlcalabash1.git</url>
+ </scm>
+
+ <dependencies>
+ <!--
+ Files in the Calabash lib directory, and current status in the dependency list below:
+
+ htmlparser-1.3.1.jar - LATEST NOT IN MAVEN - used for the unescape markup step
+ saxon9he.jar - DONE
+ jing.jar - DONE
+ isorelax.jar - TRANSIENT (from jing)
+ commons-httpclient-3.1.jar - DONE
+ commons-codec-1.6.jar - TRANSIENT (from httpclient)
+ commons-logging-1.1.1.jar - TRANSIENT (from httpclient)
+ tagsoup-1.2.jar - DONE
+ xmlresolver.jar - NOT NEEDED - not used currently - and from Norm, so could be added to Maven
+ msv.jar - NOT NEEDED - used by ValidateWithRNG, which is unused (ValidateJing preferred)
+ -->
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>Saxon-HE</artifactId>
+ <version>9.4</version>
+ </dependency>
+
+ <!-- No need to specify commons-logging or commons-codec - they're transitive dependencies of commons-httpclient -->
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.thaiopensource</groupId>
+ <artifactId>jing</artifactId>
+ <version>20091111</version>
+ <exclusions>
+ <exclusion>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ccil.cowan.tagsoup</groupId>
+ <artifactId>tagsoup</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <!-- @todo nu.validator.htmlparser version 1.3.1 doesn't exist in Maven yet.
+ Version 1.2.1 does. -->
+ <!--
+ <dependency>
+ <groupId>nu.validator.htmlparser</groupId>
+ <artifactId>htmlparser</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ -->
+ </dependencies>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>sonatype-nexus-snapshots</id>
+ <name>Sonatype Nexus Snapshots</name>
+ <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ <repository>
+ <id>sonatype-nexus-staging</id>
+ <name>Nexus Release Repository</name>
+ <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+ </repository>
+ </distributionManagement>
+</project>

0 comments on commit faf111b

Please sign in to comment.