Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
41 changes: 38 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,51 @@
```
MultiAddress m = new MultiAddress("/ip4/127.0.0.1/tcp/1234");
```

or

```
MultiAddress m = new MultiAddress("/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC");
```

## Compilation
## Dependency
You can use this project by building the JAR file as specified below, or by using [JitPack](https://jitpack.io/#multiformats/java-multiaddr/) (also supporting Gradle, SBT, etc).

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-multiaddr</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
20 changes: 10 additions & 10 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,30 @@
<manifestclasspath property="manifest_cp" jarfile="myjar.jar">
<classpath refid="dep.runtime" />
</manifestclasspath>
<jar jarfile="${dist}/Multiaddr.jar" basedir="${build}">
<jar jarfile="${dist}/multiaddr.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="multiaddr"/>
<attribute name="Implementation-Version" value="1.0.0"/>
</manifest>
</jar>
<copy todir=".">
<fileset file="${dist}/Multiaddr.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="Multiaddr.jar" />
<pathelement location="lib/multihash.jar" />
<pathelement location="dist/multiaddr.jar" />
</classpath>
<test name="org.ipfs.api.MultiaddrTests" haltonfailure="yes">
<test name="io.ipfs.multiaddr.MultiAddressTest" haltonfailure="yes">
<formatter type="plain"/>
<formatter type="xml"/>
</test>
</junit>
</junit>
</target>

<target name="clean" description="clean up">
Expand Down
Binary file removed lib/Multihash.jar
Binary file not shown.
Binary file added lib/multihash.jar
Binary file not shown.
96 changes: 96 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<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>multiaddr</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

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

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

<scm>
<url>https://github.com/multiformats/java-multiaddr</url>
<connection>scm:git:git://github.com/multiformats/java-multiaddr.git</connection>
<developerConnection>scm:git:git@github.com:multiformats/java-multiaddr.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>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<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>
<dependency>
<groupId>com.github.multiformats</groupId>
<artifactId>java-multihash</artifactId>
<version>v1.0.0</version>
</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.multiaddr;

import java.math.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ipfs.api;
package io.ipfs.multiaddr;

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

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

import org.junit.*;

Expand All @@ -7,7 +7,7 @@
import java.util.function.*;
import java.util.stream.*;

public class MultiAddressTests {
public class MultiAddressTest {

@Test
public void fails() {
Expand Down