diff --git a/README.md b/README.md index 12e6d1e..5da9f54 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Then in your `build.sbt` configure the following settings: ```scala organizationName := "Heiko Seeberger" startYear := Some(2015) -licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")) +licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")) ``` This configuration will apply Apache License 2.0 headers to Scala and Java files. sbt-header provides two tasks: `headerCreate` and `headerCheck`, which are described in the following sub sections. For more information on how to customize sbt-header, please refer to the [Configuration](#configuration) section. diff --git a/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt b/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt index a2de471..14c5755 100644 --- a/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt +++ b/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt @@ -1,7 +1,7 @@ organizationName := "Heiko Seeberger" startYear := Some(2015) headerEndYear := Some(2022) -licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))) +licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt"))) val checkFileContents = taskKey[Unit]("Verify file contents match expected contents") diff --git a/src/sbt-test/sbt-header/auto-detection-with-different-style/test.sbt b/src/sbt-test/sbt-header/auto-detection-with-different-style/test.sbt index 76d502a..b4c0dba 100644 --- a/src/sbt-test/sbt-header/auto-detection-with-different-style/test.sbt +++ b/src/sbt-test/sbt-header/auto-detection-with-different-style/test.sbt @@ -1,4 +1,4 @@ organizationName := "Heiko Seeberger" startYear := Some(2015) -licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))) +licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt"))) headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax diff --git a/src/sbt-test/sbt-header/auto-detection/test.sbt b/src/sbt-test/sbt-header/auto-detection/test.sbt index cbfa2a6..b613928 100644 --- a/src/sbt-test/sbt-header/auto-detection/test.sbt +++ b/src/sbt-test/sbt-header/auto-detection/test.sbt @@ -1,6 +1,6 @@ organizationName := "Heiko Seeberger" startYear := Some(2015) -licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))) +licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt"))) val checkFileContents = taskKey[Unit]("Verify file contents match expected contents") diff --git a/src/test/scala/de/heikoseeberger/sbtheader/LicenseDetectionSpec.scala b/src/test/scala/de/heikoseeberger/sbtheader/LicenseDetectionSpec.scala index b8e7869..d4c4fea 100644 --- a/src/test/scala/de/heikoseeberger/sbtheader/LicenseDetectionSpec.scala +++ b/src/test/scala/de/heikoseeberger/sbtheader/LicenseDetectionSpec.scala @@ -18,6 +18,7 @@ package de.heikoseeberger.sbtheader import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.HeaderLicense._ import sbt.URL +import sbt.url import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec @@ -27,47 +28,47 @@ class LicenseDetectionSpec extends AnyWordSpec with Matchers { val yyyy = "2017" val startYear = Some(yyyy) val apache: (String, URL) = - ("Apache-2.0", new URL("https://spdx.org/licenses/Apache-2.0.html#licenseText")) - val mit: (String, URL) = ("MIT", new URL("https://spdx.org/licenses/MIT.html#licenseText")) + ("Apache-2.0", url("https://spdx.org/licenses/Apache-2.0.html#licenseText")) + val mit: (String, URL) = ("MIT", url("https://spdx.org/licenses/MIT.html#licenseText")) val licenses: Map[License, (String, URL)] = Map( - BSD2Clause(yyyy.toString, organizationName) -> ("BSD-2-Clause", new URL( + BSD2Clause(yyyy.toString, organizationName) -> ("BSD-2-Clause", url( "https://spdx.org/licenses/BSD-2-Clause.html#licenseText" )), - BSD3Clause(yyyy.toString, organizationName) -> ("BSD-3-Clause", new URL( + BSD3Clause(yyyy.toString, organizationName) -> ("BSD-3-Clause", url( "https://spdx.org/licenses/BSD-3-Clause.html#licenseText" )), - AGPLv3OrLater(yyyy.toString, organizationName) -> ("AGPL-3.0-or-later", new URL( + AGPLv3OrLater(yyyy.toString, organizationName) -> ("AGPL-3.0-or-later", url( "https://spdx.org/licenses/AGPL-3.0-or-later.html#licenseText" )), - AGPLv3Only(yyyy.toString, organizationName) -> ("AGPL-3.0-only", new URL( + AGPLv3Only(yyyy.toString, organizationName) -> ("AGPL-3.0-only", url( "https://spdx.org/licenses/AGPL-3.0-only.html#licenseText" )), - AGPLv3(yyyy.toString, organizationName) -> ("AGPL-3.0", new URL( + AGPLv3(yyyy.toString, organizationName) -> ("AGPL-3.0", url( "https://spdx.org/licenses/AGPL-3.0.html#licenseText" )), ALv2(yyyy.toString, organizationName) -> apache, - GPLv3OrLater(yyyy.toString, organizationName) -> ("GPL-3.0-or-later", new URL( + GPLv3OrLater(yyyy.toString, organizationName) -> ("GPL-3.0-or-later", url( "https://spdx.org/licenses/GPL-3.0-or-later.html#licenseText" )), - GPLv3Only(yyyy.toString, organizationName) -> ("GPL-3.0-only", new URL( + GPLv3Only(yyyy.toString, organizationName) -> ("GPL-3.0-only", url( "https://spdx.org/licenses/GPL-3.0-only.html#licenseText" )), - GPLv3(yyyy.toString, organizationName) -> ("GPL-3.0", new URL( + GPLv3(yyyy.toString, organizationName) -> ("GPL-3.0", url( "https://spdx.org/licenses/GPL-3.0.html#licenseText" )), - LGPLv3OrLater(yyyy.toString, organizationName) -> ("LGPL-3.0-or-later", new URL( + LGPLv3OrLater(yyyy.toString, organizationName) -> ("LGPL-3.0-or-later", url( "https://spdx.org/licenses/LGPL-3.0-or-later.html#licenseText" )), - LGPLv3Only(yyyy.toString, organizationName) -> ("LGPL-3.0-only", new URL( + LGPLv3Only(yyyy.toString, organizationName) -> ("LGPL-3.0-only", url( "https://spdx.org/licenses/LGPL-3.0-only.html#licenseText" )), - LGPLv3(yyyy.toString, organizationName) -> ("LGPL-3.0", new URL( + LGPLv3(yyyy.toString, organizationName) -> ("LGPL-3.0", url( "https://spdx.org/licenses/LGPL-3.0.html#licenseText" )), MIT(yyyy.toString, organizationName) -> mit, - MPLv2(yyyy.toString, organizationName) -> ("MPL-2.0", new URL( + MPLv2(yyyy.toString, organizationName) -> ("MPL-2.0", url( "https://spdx.org/licenses/MPL-2.0.html#licenseText" )) )