Skip to content

Commit a6b1903

Browse files
authored
Publish artifacts to Sonatype / Maven Central (#11)
- Add sbt-sonatype plugin - Add build publishing information - Remove sbt-bintray
1 parent cc71591 commit a6b1903

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

build.sbt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ scalaVersion := Scala_2_13
88
ThisBuild / versionScheme := Some("early-semver")
99
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
1010

11-
ThisBuild / bintrayOrganization := Some("rallyhealth")
12-
ThisBuild / bintrayRepository := "maven"
11+
// reload sbt when the build files change
12+
Global / onChangedBuildSource := ReloadOnSourceChanges
1313

14+
ThisBuild / homepage := Some(url("https://github.com/rallyhealth/play-module-json-error-handler"))
15+
ThisBuild / developers := List(
16+
Developer(id = "jeffmay", name = "Jeff May", email = "jeff.n.may@gmail.com", url = url("https://github.com/jeffmay")),
17+
)
18+
19+
// TODO: Remove this after Bintray is no longer required for binary compatibility checking
1420
ThisBuild / resolvers += Resolver.bintrayRepo("rallyhealth", "maven")
1521

1622
// Disable publishing of root project
@@ -23,7 +29,7 @@ def commonProject(id: String, path: String): Project = {
2329
Project(id, file(path))
2430
.settings(
2531
// verify binary compatibility
26-
mimaPreviousArtifacts := Set(organization.value %% name.value % "0.3.0"),
32+
mimaPreviousArtifacts := Set(organization.value %% name.value % "0.5.0"),
2733

2834
// disable scaladoc generation
2935
Compile / doc / sources := Seq.empty,
@@ -74,8 +80,4 @@ def playModuleJsonErrorHandler(includePlayVersion: String): Project = {
7480
lazy val play25 = playModuleJsonErrorHandler(Play_2_5)
7581
lazy val play26 = playModuleJsonErrorHandler(Play_2_6)
7682
lazy val play27 = playModuleJsonErrorHandler(Play_2_7)
77-
lazy val play28 = playModuleJsonErrorHandler(Play_2_8).settings(
78-
// this artifact is new, so don't try to download older artifacts
79-
mimaPreviousArtifacts := Set(),
80-
mimaFailOnNoPrevious := false,
81-
)
83+
lazy val play28 = playModuleJsonErrorHandler(Play_2_8)

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
22
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
3-
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1")
4-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
3+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
4+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")

sonatype.sbt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Your profile name of the sonatype account. The default is the same with the organization value
2+
sonatypeProfileName := "com.rallyhealth"
3+
4+
// To sync with Maven central, you need to supply the following information:
5+
publishMavenStyle := true
6+
7+
// publish to Maven Central
8+
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
9+
ThisBuild / publishTo := Some {
10+
if (isSnapshot.value)
11+
Resolver.url("Sonatype", url("https://s01.oss.sonatype.org/content/repositories/snapshots"))
12+
else
13+
Resolver.url("Sonatype", url("https://s01.oss.sonatype.org/content/repositories/releases"))
14+
}
15+
16+
// add SNAPSHOT to non-release versions so they are not published to the main repo
17+
ThisBuild / dynverSonatypeSnapshots := true
18+
// Use '-' instead of '+' for simpler snapshot URLs
19+
ThisBuild / dynverSeparator := "-"
20+
21+
import xerial.sbt.Sonatype.GitHubHosting
22+
sonatypeProjectHosting := Some(GitHubHosting("rallyhealth", "play-module-json-error-handler", "jeff.n.may@gmail.com"))

0 commit comments

Comments
 (0)