diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..eb8b7b5
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,25 @@
+name: CI
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ java-version: ['11', '17', '21', '25']
+ name: Test (Java ${{ matrix.java-version }})
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK ${{ matrix.java-version }}
+ uses: actions/setup-java@v4
+ with:
+ java-version: ${{ matrix.java-version }}
+ distribution: 'temurin'
+
+ - name: Run tests
+ run: mvn test
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..ae0edb6
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,27 @@
+name: Publish to GitHub Packages
+
+on:
+ release:
+ types: [created]
+
+permissions:
+ contents: read
+ packages: write
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ java-version: '11'
+ distribution: 'temurin'
+ server-id: github
+
+ - name: Publish package
+ run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/README.md b/README.md
index 5082985..96ab6ca 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,21 @@ Java implementation of the [NSV (Newline-Separated Values)](https://nsv-format.o
## Installation
+Maven Central publishing is planned. For now, the package is available via [GitHub Packages](https://github.com/nsv-format/nsv-java/packages), which requires a GitHub account and a personal access token with `read:packages` scope.
+
### Maven
+Add the repository to your `pom.xml` or `~/.m2/settings.xml`:
+
+```xml
+
+ github
+ https://maven.pkg.github.com/nsv-format/nsv-java
+
+```
+
+Then add the dependency:
+
```xml
org.nsv-format
@@ -17,7 +30,19 @@ Java implementation of the [NSV (Newline-Separated Values)](https://nsv-format.o
### Gradle
```groovy
-implementation 'org.nsv-format:nsv-java:0.2.0'
+repositories {
+ maven {
+ url = uri("https://maven.pkg.github.com/nsv-format/nsv-java")
+ credentials {
+ username = System.getenv("GITHUB_ACTOR")
+ password = System.getenv("GITHUB_TOKEN")
+ }
+ }
+}
+
+dependencies {
+ implementation 'org.nsv-format:nsv-java:0.2.0'
+}
```
## Usage
diff --git a/pom.xml b/pom.xml
index b24bdbf..efa7493 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,6 +11,30 @@
nsv-java
Java implementation of NSV (Newline-Separated Values) format
+ https://github.com/nsv-format/nsv-java
+
+
+
+ MIT License
+ https://opensource.org/licenses/MIT
+ repo
+
+
+
+
+ scm:git:git://github.com/nsv-format/nsv-java.git
+ scm:git:ssh://github.com:nsv-format/nsv-java.git
+ https://github.com/nsv-format/nsv-java
+
+
+
+
+
+ nsv-format
+ nsv-format
+ https://github.com/nsv-format
+
+
11
diff --git a/src/test/java/org/nsvformat/EscapeTest.java b/src/test/java/org/nsvformat/EscapeTest.java
index b499a48..4c265f8 100644
--- a/src/test/java/org/nsvformat/EscapeTest.java
+++ b/src/test/java/org/nsvformat/EscapeTest.java
@@ -2,6 +2,7 @@
import org.junit.jupiter.api.Test;
import java.util.List;
+import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.*;
public class EscapeTest {
@@ -82,13 +83,13 @@ public void testEscapeSeqseqUsingMap() {
);
List> result = seqseq.stream()
- .map(row -> row.stream().map(Nsv::escape).toList())
- .toList();
+ .map(row -> row.stream().map(Nsv::escape).collect(Collectors.toList()))
+ .collect(Collectors.toList());
assertEquals(expected, result);
List> recovered = result.stream()
- .map(row -> row.stream().map(Nsv::unescape).toList())
- .toList();
+ .map(row -> row.stream().map(Nsv::unescape).collect(Collectors.toList()))
+ .collect(Collectors.toList());
assertEquals(seqseq, recovered);
}
}