-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildPublish.sbt
51 lines (38 loc) · 1.81 KB
/
buildPublish.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import aether.Aether._
import aether.MavenCoordinates
import com.typesafe.sbt.SbtNativePackager._
import com.typesafe.sbt.packager.universal.Keys._
import sbt.Keys.{name, version, _}
import sbt._
version in ThisBuild := "2.0.0" + "-" + gitHeadCommitSha
//
// Settings related to publishing this project artifact to nexus during (during deployment)
//
// Note: this is used by yetu internally to package and later deploy the application
// If you wish to use it, you need to adapt the hardcoded nexus URLs
//-----------------------------------------------------------------------------------------
lazy val gitHeadCommitSha = Process(
"git rev-parse --short=8 HEAD").lines.head
publish <<= (publish) dependsOn (publish in Universal)
publishLocal <<= (publishLocal) dependsOn (publishLocal in Universal)
crossPaths := false
aetherPublishBothSettings
aetherArtifact <<= (organization, name in Universal, version, packageZipTarball in Universal, makePom in Compile, packagedArtifacts in Universal) map {
(organization, name, version, binary, pom, artifacts) =>
val nameWithoutVersion = name.replace(s"-$version", "")
createArtifact(artifacts, pom, MavenCoordinates(organization, nameWithoutVersion, version, None, "tgz"), binary
)
}
publishMavenStyle := true
publishTo <<= version { (v: String) =>
// Note: this is used by yetu internally to package and later deploy the application
// If you wish to use it, you need to adapt the hardcoded nexus URLs
val nexus = "http://ah-nexus000.yetudev.com:8081/nexus/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "content/repositories/releases")
}
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishArtifact in Test := false
pomIncludeRepository := { _ => false }