LOG4J2-2291: Add Jenkins pipeline for SBT build
Add credential id and config for publishing snapshots.
diff --git a/Jenkinsfile b/Jenkinsfile
index 032d4d1..13614bb 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -42,12 +42,16 @@
when { branch 'master' }
steps {
ansiColor('xterm') {
- sh './sbt -batch "+ publish"'
- // FIXME: LOG4J2-2291
- archiveArtifacts artifacts: 'target/repository/**'
+ withCredentials([
+ usernamePassword(
+ credentialsId: 'logging-snapshots',
+ passwordVariable: 'NEXUS_PASSWORD',
+ usernameVariable: 'NEXUS_USERNAME')
+ ]) {
+ sh './sbt -batch "+ publish"'
+ }
}
}
}
}
}
-
diff --git a/build.sbt b/build.sbt
index 6dba52b..386e479 100644
--- a/build.sbt
+++ b/build.sbt
@@ -46,15 +46,20 @@
publishArtifact in Test := false,
publishTo := {
if (isSnapshot.value) {
- // FIXME: LOG4J2-2291
- //Some("Apache Snapshots" at "https://repository.apache.org/content/repositories/snapshots")
- Some(Resolver.file("file", file("target/repository/")))
+ Some("Apache Snapshots" at "https://repository.apache.org/content/repositories/snapshots")
} else {
Some("Apache Releases" at "https://repository.apache.org/service/local/staging/deploy/maven2")
}
- }
-// credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
-// managedResources
+ },
+ credentials ++= {
+ for {
+ username <- sys.env.get("NEXUS_USERNAME")
+ password <- sys.env.get("NEXUS_PASSWORD")
+ } yield Credentials("Sonatype Nexus Repository Manager", "repository.apache.org", username, password)
+ }.toList,
+ // FIXME: https://github.com/sbt/sbt/issues/3519
+ updateOptions := updateOptions.value.withGigahorse(false)
+ // managedResources
// resourceGenerators in Compile += inlineTask(Seq(file("LICENSE.txt"), file("NOTICE.txt")))
)