Skip to content

Commit

Permalink
Merge pull request #2 from celeduc/mavenize
Browse files Browse the repository at this point in the history
Mavenize, rename and reorganize build elements
  • Loading branch information
ianopolous committed Dec 11, 2016
2 parents 93eed1a + 6b8dd30 commit 5a482de
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.class

target/**
build/**
dist/**
.idea/**
Expand Down
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,45 @@ This is the [multihash](https://github.com/multiformats/multihash) implementatio
```
Multihash m = Multihash.fromBase58("QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy");
```
## Dependency
You can use this project by building the JAR file as specified below, or by using [JitPack](https://jitpack.io/#multiformats/java-multihash/) (also supporting Gradle, SBT, etc).

## Compilation
for Maven, you can add the follwing sections to your POM.XML:
```
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.multiformats</groupId>
<artifactId>java-multihash</artifactId>
<version>v1.0.0</version>
</dependency>
</dependencies>
```

## Testing

### Ant
`ant test`

### Maven
`mvn test`

## Building

### Ant
`ant dist` will build a JAR file in the `./dist` suitable for manual inclusion in a project. Dependent libraries are included in `./dist/lib`.

### Maven
`mvn package` will build a JAR file with Maven dependency information.

To compile just run ant.
## Releasing
The version number is specified in `build.xml` and `pom.xml` and must be changed in both places in order to be accurately reflected in the JAR file manifest. A git tag must be added in the format "vx.x.x" for JitPack to work.

## Maintainers

Expand Down
23 changes: 11 additions & 12 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<target name="compile" depends="init" description="compile the source">
<javac includeantruntime="false" srcdir="${src}" destdir="${build}" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</classpath>
Expand All @@ -35,30 +35,29 @@
<manifestclasspath property="manifest_cp" jarfile="myjar.jar">
<classpath refid="dep.runtime" />
</manifestclasspath>
<jar jarfile="${dist}/Multihash.jar" basedir="${build}">
<jar jarfile="${dist}/multihash.jar" basedir="${build}">
<manifest>
<attribute name="Class-Path" value="${manifest_cp}"/>
<attribute name="Class-Path" value="${manifest_cp}"/>
<attribute name="Implementation-Vendor" value="io.ipfs"/>
<attribute name="Implementation-Title" value="multihash"/>
<attribute name="Implementation-Version" value="1.0.0"/>
</manifest>
</jar>
<copy todir=".">
<fileset file="${dist}/Multihash.jar"/>
</copy>
</target>


<target name="test" depends="compile,dist">
<junit printsummary="yes" fork="true" haltonfailure="yes">
<jvmarg value="-Xmx1g"/>
<classpath>
<pathelement location="lib/junit-4.11.jar" />
<pathelement location="lib/hamcrest-core-1.3.jar" />
<pathelement location="Multihash.jar" />
<pathelement location="lib/junit-4.11.jar" />
<pathelement location="lib/hamcrest-core-1.3.jar" />
<pathelement location="dist/multihash.jar" />
</classpath>
<test name="org.ipfs.api.MultihashTests" haltonfailure="yes">
<test name="io.ipfs.multihash.MultihashTest" haltonfailure="yes">
<formatter type="plain"/>
<formatter type="xml"/>
</test>
</junit>
</junit>
</target>

<target name="clean" description="clean up">
Expand Down
84 changes: 84 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<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>io.ipfs</groupId>
<artifactId>multihash</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>multihash</name>
<url>https://github.com/multiformats/java-multihash</url>

<issueManagement>
<url>https://github.com/multiformats/java-multihash/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<scm>
<url>https://github.com/multiformats/java-multihash</url>
<connection>scm:git:git://github.com/multiformats/java-multihash.git</connection>
<developerConnection>scm:git:[email protected]:multiformats/java-multihash.git</developerConnection>
</scm>

<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/multiformats/java-multiaddr/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ipfs.api;
package io.ipfs.multihash;

/**
* Copyright 2011 Google Inc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ipfs.api;
package io.ipfs.multihash;

import java.io.*;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.ipfs.api;
package io.ipfs.multihash;

import org.junit.*;

import java.util.*;

public class MultihashTests {
public class MultihashTest {

@Test
public void base58Test() {
Expand Down

0 comments on commit 5a482de

Please sign in to comment.