Skip to content

Commit

Permalink
Add distribution through OSSRH (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanokwa authored and lognaturel committed Mar 28, 2017
1 parent 1cee502 commit 7fefddf
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 6 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# java
*.class

# gradle
.gradle
build

# intellij
.idea
*.class

# mvn
target
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ To build the project, go to the `View` menu, then `Tool Windows > Gradle`. `buil

To package a jar, use the `jar` Gradle task.

## Distributing the jar

We use [OSSRH](https://central.sonatype.org/pages/ossrh-guide.html) to distribute this jar to a few public Maven and Gradle repositories. This process is [outlined here](https://central.sonatype.org/pages/apache-maven.html).

While we use gradle as our default build tool for all ODK tools (including this one), we use maven for distributing the jar because OSSRH's gradle support is unreliable (e.g., snapshots don't always update). This means version and dependency changes must be made in both `build.gradle` and `pom.xml`.

One deviation from OSSRH's documentation is that we use the latest versions of the maven plugins in `pom.xml`. Another deviation is that our `settings.xml` includes `gpg.homedir`, `gpg.keyname`, and `gpg.passphrase` so core committers can easily refer to the `opendatakit.gpg` folder.
```
<!-- ${user.home}/.m2/settings.xml -->
<settings>
<profiles>
<profile>
...
<properties>
<gpg.homedir>/path/to/opendatakit.gpg</gpg.homedir>
<gpg.keyname>the_keyname</gpg.keyname>
<gpg.passphrase>the_passphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
```

## Contributing code
Any and all contributions to the project are welcome. ODK JavaRosa is used across the world primarily by organizations with a social purpose so you can have real impact!

Expand Down
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ sourceSets.main.java.srcDirs = ['src']
sourceSets.test.java.srcDirs = ['test']
sourceSets.test.resources.srcDirs = ['resources']

targetCompatibility = '1.7'
sourceCompatibility = '1.7'

dependencies {
// Be sure to update dependencies in pom.xml to match
compileOnly group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'

testCompile group: 'junit', name: 'junit', version: '3.8.2'
testCompile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
}

jar {
baseName = 'javarosa'
version = new Date().format('yyyy-MM-dd')
baseName = 'opendatakit-javarosa'
// Be sure to update version in pom.xml to match
version = '2.1.0-SNAPSHOT'
archiveName = baseName + '-' + version + '.jar'

manifest {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 01 16:39:47 ICT 2017
#Thu Mar 23 16:28:57 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-3.3-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
118 changes: 118 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendatakit</groupId>
<artifactId>opendatakit-javarosa</artifactId>
<!-- Be sure to update version in build.gradle to match -->
<version>2.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>opendatakit-javarosa</name>
<description>A Java library for rendering forms that are compliant with ODK XForms spec</description>
<url>https://github.com/opendatakit/javarosa</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>opendatakit</name>
<email>[email protected]</email>
<organization>Open Data Kit</organization>
<organizationUrl>https://opendatakit.org</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git:https://github.com/opendatakit/javarosa.git</connection>
<developerConnection>scm:git:ssh:https://github.com:opendatakit/javarosa.git</developerConnection>
<url>https://github.com/opendatakit/javarosa/tree/master</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<!-- Be sure to update dependencies in build.gradle to match -->
<groupId>net.sf.kxml</groupId>
<artifactId>kxml2</artifactId>
<version>2.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<!-- Collect, Briefcase, and Validate expect Java 1.7 -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<!-- Turn off doclint in JDK 8 because it errors instead of warns -->
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 7fefddf

Please sign in to comment.