Skip to content

Commit

Permalink
fix #507: Add tests on JDK 8, 11, and 17 to fix missing method (java.…
Browse files Browse the repository at this point in the history
…nio.file.Path.of) error (#508)

* Test on JDK 8, 11, and 17

* Use Paths.get

**Problem**
Path.of doesn't exist on JDK 8.

**Solution**
Use Paths.get.
  • Loading branch information
eed3si9n authored Aug 19, 2024
1 parent c0c099b commit 7824290
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@ jobs:
- uses: actions/checkout@v4
- name: scalafmt
run: ./sbt scalafmtCheckAll
test_jdk11:
name: Test JDK11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: sbt scripted test
run: ./sbt compile scripted
test_jdk17:
name: Test JDK17
runs-on: ubuntu-latest
test:
name: Test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
distribution: zulu
java: 8
- os: ubuntu-latest
distribution: temurin
java: 11
- os: ubuntu-latest
distribution: temurin
java: 17
- os: windows-latest
distribution: temurin
java: 17
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: sbt scripted test
run: ./sbt compile scripted
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package xerial.sbt.sonatype

import com.lumidion.sonatype.central.client.core.{DeploymentName, PublishingType}
import java.io.{File, FileInputStream, FileOutputStream}
import java.nio.file.{Files, Path}
import java.nio.file.{Files, Path, Paths}
import java.util.zip.{ZipEntry, ZipOutputStream}
import scala.util.Try
import wvlet.log.LogSupport
Expand All @@ -16,7 +16,7 @@ private[sbt] class SonatypeCentralService(client: SonatypeCentralClient) extends
deploymentName: DeploymentName,
publishingType: PublishingType
): Either[SonatypeException, Unit] = for {
bundleZipDirectory <- Try(Files.createDirectory(Path.of(s"${localBundlePath.getPath}-bundle"))).toEither.leftMap {
bundleZipDirectory <- Try(Files.createDirectory(Paths.get(s"${localBundlePath.getPath}-bundle"))).toEither.leftMap {
err =>
SonatypeException(BUNDLE_ZIP_ERROR, s"Error creating bundle zip directory. ${err.getMessage}")
}
Expand Down

0 comments on commit 7824290

Please sign in to comment.