From 43c78afca4151e14ee6c35f2130a77c6a2156f2f Mon Sep 17 00:00:00 2001 From: Erik Erlandson Date: Fri, 16 Jul 2021 16:27:48 -0700 Subject: [PATCH] publish to sonatype (#4) * publish to sonatype * sbt test:console --- README.md | 26 ++++++---------- build.sbt | 67 ++++++++++++++++++++++++++++++++-------- project/build.properties | 2 +- project/plugins.sbt | 17 +++------- 4 files changed, 70 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index f622b5e..d9fd5e7 100644 --- a/README.md +++ b/README.md @@ -16,37 +16,27 @@ A few examples are below. * Enforce inequality constraints of the form s(x) < y and s(x) > y ### How to use `snowball` in your project -The `snowball` package is implemented in java, and so it can be used in both java and scala. It is built on, and designed to work with, Apache Commons Math 3.6 - -`snowball` expects you to provide `commons-math3` and `gibbous` dependencies, as shown here: +The `snowball` package is implemented in java, and so it can be used in both java and scala. It is built on, and designed to work with, Apache Commons Math 3.6. #### using SBT ```scala -resolvers += "manyangled" at "https://dl.bintray.com/manyangled/maven/" - libraryDependencies ++= Seq( - "com.manyangled" % "snowball" % "0.2.2", - "com.manyangled" % "gibbous" % "0.2.2", - "org.apache.commons" % "commons-math3" % "3.6.1") + "com.manyangled" % "snowball" % "0.3.0" + ) ``` + #### using maven ```xml com.manyangled snowball - 0.2.2 + 0.3.0 pom com.manyangled gibbous - 0.2.2 - pom - - - org.apache.commons - commons-math3 - 3.6.1 + 0.3.0 pom ``` @@ -65,6 +55,10 @@ PolynomialSplineFunction s = interpolator.interpolate(x, y); ``` #### Scala REPL +```sh +$ sbt test:console +``` + ```scala scala> import com.manyangled.snowball.analysis.interpolation._, com.manyangled.gnuplot4s._ import com.manyangled.snowball.analysis.interpolation._ diff --git a/build.sbt b/build.sbt index 840fc9b..20e9ece 100644 --- a/build.sbt +++ b/build.sbt @@ -1,11 +1,58 @@ + +// do clean first! +// sbt clean +// sbt unidoc +// sbt previewSite +// sbt ghpagesPushSite + +// initiate publish from clean repo +// sbt clean +// sbt publish + name := "snowball" +version := "0.3.0" + organization := "com.manyangled" -version := "0.2.3-SNAPSHOT" +//isSnapshot := true, + +//publishConfiguration := publishConfiguration.value.withOverwrite(true) //publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true) +pomIncludeRepository := { _ => false } + +publishMavenStyle := true + +publishTo := { + val nexus = "https://oss.sonatype.org/" + if (isSnapshot.value) + Some("snapshots" at nexus + "content/repositories/snapshots") + else + Some("releases" at nexus + "service/local/staging/deploy/maven2") +} + +licenses += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")) + +homepage := Some(url("https://github.com/erikerlandson/snowball/")) + +scmInfo := Some( + ScmInfo( + url("https://github.com/erikerlandson/snowball.git"), + "scm:git@github.com:erikerlandson/snowball.git" + ) +) + +developers := List( + Developer( + id = "erikerlandson", + name = "Erik Erlandson", + email = "eje@redhat.com", + url = url("https://erikerlandson.github.io/") + ) +) + crossPaths := false // drop off Scala suffix from artifact names. autoScalaLibrary := false // exclude scala-library from dependencies @@ -15,27 +62,21 @@ resolvers ++= Seq( Resolver.sonatypeRepo("snapshots") ) +// commons math used to be '% Provided' but the 'packageDoc' target +// now fails with that, so I'm just going to make it required libraryDependencies ++= Seq( - "org.apache.commons" % "commons-math3" % "3.6.1" % Provided, - "com.manyangled" % "gibbous" % "0.2.2" % Provided, - "com.manyangled" %% "gnuplot4s" % "0.1.0" % Test, + "org.apache.commons" % "commons-math3" % "3.6.1", + "com.manyangled" % "gibbous" % "0.3.0", + "com.manyangled" %% "gnuplot4s" % "0.2.0" % Test, "org.hamcrest" % "hamcrest-library" % "1.3" % Test, "com.novocode" % "junit-interface" % "0.11" % Test ) -licenses += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")) - compileOrder := CompileOrder.JavaThenScala javacOptions ++= Seq() -scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") - -scalacOptions in (Compile, doc) ++= Seq("-doc-root-content", baseDirectory.value+"/root-doc.txt") - -// xsbt clean xsbt unidoc; xsbt previewSite; xsbt ghpagesPushSite // do clean first! - -enablePlugins(JavaUnidocPlugin, GenJavadocPlugin, PublishJavadocPlugin, GhpagesPlugin) +enablePlugins(JavaUnidocPlugin, PublishJavadocPlugin, GhpagesPlugin) siteSubdirName in JavaUnidoc := "java/api" diff --git a/project/build.properties b/project/build.properties index 0531343..654fe70 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.2 +sbt.version=1.3.12 diff --git a/project/plugins.sbt b/project/plugins.sbt index d4cbffd..74e2cea 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,16 +1,9 @@ -resolvers += Resolver.url( - "bintray-sbt-plugin-releases", - url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))( - Resolver.ivyStylePatterns) +resolvers += "jgit-repo" at "https://download.eclipse.org/jgit/maven" -resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/" +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") -resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven" +addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3") -// addSbtPlugin("me.lessis" % "bintray-sbt" % "0.4.0") +addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.1") -addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4") - -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2") - -addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")