Last active
August 29, 2015 14:13
-
-
Save adrobisch/689990492b972b33ee6e to your computer and use it in GitHub Desktop.
sbt central publish for Java projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.sbt.SbtNativePackager._ | |
import NativePackagerKeys._ | |
net.virtualvoid.sbt.graph.Plugin.graphSettings | |
packageArchetype.java_application | |
organization := "com.example" | |
name := "example" | |
version := "1.0-SNAPSHOT" | |
crossPaths := false | |
autoScalaLibrary := false | |
packageDescription in Debian := "Example Package" | |
maintainer in Debian := "John Foo" | |
libraryDependencies ++= Seq( | |
"junit" % "junit" % "4.11" % "test" | |
) | |
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") | |
} | |
pomExtra := | |
<url>https://github.com/example/example</url> | |
<licenses> | |
<license> | |
<name>MIT</name> | |
<url>http://opensource.org/licenses/mit-license.php</url> | |
<distribution>repo</distribution> | |
</license> | |
</licenses> | |
<scm> | |
<url>[email protected]:example/example.git</url> | |
<connection>scm:git:[email protected]:example/example.git</connection> | |
</scm> | |
<developers> | |
<developer> | |
<id>johnfoon</id> | |
<name>John Foo</name> | |
<url>http://johnfoo.com</url> | |
</developer> | |
</developers> | |
mainClass in selectMainClass := Some("com.example.MainClass") | |
addCommandAlias("dist", "universal:packageBin") | |
Release | |
======= | |
1. Change version to release version in build.sbt (e.g. 1.1) and commit it. | |
2. Tag the version: git tag <newVersion> | |
3. Run: sbt publishSigned | |
4. Change version to next development version in build.sbt (e.g. 1.2-SNAPSHOT) and commit it. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment