Permalink
Browse files

Fixed syntax to work with Jekyll/liquid

  • Loading branch information...
jsuereth committed Feb 2, 2012
1 parent 1d77c2f commit 2bc13ed38e415360f97f4a718f414cc1ab32d8a8
Showing with 76 additions and 88 deletions.
  1. +76 −88 src/jekyll/using_sonatype.md
@@ -16,60 +16,54 @@ You'll need to PGP sign your artifacts for the Sonatype repository. Don't worry
To publish to a maven repository, you'll need to configure a few settings so that the correct metadata is generated.
-```scala
-publishMavenStyle := true
-```
+
+ publishMavenStyle := true
+
is used to ensure POMs are generated and pushed. Next, you have to set up the repositories you wish to push too. Luckily, Sonatype's OSSRH uses the same URLs for everyone:
-```scala
-publishTo <<= version { (v: String) =>
- val nexus = "https://oss.sonatype.org/"
- if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
- else Some("releases" at nexus + "service/local/staging/deploy/maven2")
-}
-```
+ publishTo <<= version { (v: String) =>
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT"))
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ }
Another good idea is to not publish your test artifacts:
-```scala
-publishArtifact in Test := false
-```
+ publishArtifact in Test := false
## Third - POM Metadata ##
Now, we want to control what's available in the `pom.xml` file. This file describes our project in the maven repository and is used by indexing services for search and discover. This means it's important that `pom.xml` should have all information we wish to advertise as well as required info!
First, let's make sure no repositories show up in the POM file. To publish on maven-central, all *required* artifacts must also be hosted on maven central. However, sometimes we have optional dependencies for special features. If that's the case, let's remove the repositories for optional dependencies in our artifact:
-```scala
-pomIncludeRepository := { x => false }
-```
+ pomIncludeRepository := { x => false }
Next, the POM metadata that isn't generated by SBT must be added. This is done through the `pomExtra` configuration option:
-```scala
-pomExtra := (
- <url>http://jsuereth.com/scala-arm</url>
- <licenses>
- <license>
- <name>BSD-style</name>
- <url>http://www.opensource.org/licenses/bsd-license.php</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <url>git@github.com:jsuereth/scala-arm.git</url>
- <connection>scm:git:git@github.com:jsuereth/scala-arm.git</connection>
- </scm>
- <developers>
- <developer>
- <id>jsuereth</id>
- <name>Josh Suereth</name>
- <url>http://jsuereth.com</url>
- </developer>
- </developers>)
-```
+ pomExtra := (
+ <url>http://jsuereth.com/scala-arm</url>
+ <licenses>
+ <license>
+ <name>BSD-style</name>
+ <url>http://www.opensource.org/licenses/bsd-license.php</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>git@github.com:jsuereth/scala-arm.git</url>
+ <connection>scm:git:git@github.com:jsuereth/scala-arm.git</connection>
+ </scm>
+ <developers>
+ <developer>
+ <id>jsuereth</id>
+ <name>Josh Suereth</name>
+ <url>http://jsuereth.com</url>
+ </developer>
+ </developers>)
Specifically, the `url`, `license`, `scm.url`, `scm.connection` and `developer` sections are required. The above is an example from the [scala-arm](http://jsuereth.com/scala-arm) project.
@@ -79,10 +73,10 @@ Specifically, the `url`, `license`, `scm.url`, `scm.connection` and `developer`
The credentails for your Sonatype OSSRH account need to be added somewhere. Common convention is a `~/.sbt/sonatype.sbt` file with the following:
-```scala
-credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org",
- "<your username>", "<your password>")
-```
+ credentials += Credentials("Sonatype Nexus Repository Manager",
+ "oss.sonatype.org",
+ "<your username>",
+ "<your password>")
*Note: The first two strings **must** be `"Sonatype Nexus Repository Manager"` and `"oss.sonatype.org"` for Ivy to use the credentials.*
@@ -133,59 +127,53 @@ you'll then need to:
This file (kept *outside the VCS*) contains the Sonatype credentials settings:
-```scala
-credentials += Credentials("Sonatype Nexus Repository Manager",
- "oss.sonatype.org",
- "your-sonatype-username",
- "your-sonatype-password")
-```
+ credentials += Credentials("Sonatype Nexus Repository Manager",
+ "oss.sonatype.org",
+ "your-sonatype-username",
+ "your-sonatype-password")
#### project/plugins.sbt
This file specifies the plugins for your project. If you intend to sign the artefacts, you'll need to include @jsuereth's `xsbt-gpg-plugin`:
-```scala
-resolvers += "sbt-plugin-releases" at "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"
-
-addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.5")
-```
+ resolvers += "sbt-plugin-releases" at "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"
+
+ addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.5")
#### build.sbt
Finally, you'll need to tweak the generated POM in your `build.sbt`. The tweaks include specifying the project's authors, URL, SCM and many others:
-```scala
-publishTo <<= version { v: String =>
- val nexus = "https://oss.sonatype.org/"
- if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
- else Some("releases" at nexus + "service/local/staging/deploy/maven2")
-}
-
-publishMavenStyle := true
-
-publishArtifact in Test := false
-
-pomIncludeRepository := { x => false }
-
-pomExtra := (
- <url>http://your.project.url</url>
- <licenses>
- <license>
- <name>BSD-style</name>
- <url>http://www.opensource.org/licenses/bsd-license.php</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <url>git@github.com:your-account/your-project.git</url>
- <connection>scm:git:git@github.com:your-account/your-project.git</connection>
- </scm>
- <developers>
- <developer>
- <id>you</id>
- <name>Your Name</name>
- <url>http://your.url</url>
- </developer>
- </developers>
-)
-```
+ publishTo <<= version { v: String =>
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
+ else Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ }
+
+ publishMavenStyle := true
+
+ publishArtifact in Test := false
+
+ pomIncludeRepository := { x => false }
+
+ pomExtra := (
+ <url>http://your.project.url</url>
+ <licenses>
+ <license>
+ <name>BSD-style</name>
+ <url>http://www.opensource.org/licenses/bsd-license.php</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>git@github.com:your-account/your-project.git</url>
+ <connection>scm:git:git@github.com:your-account/your-project.git</connection>
+ </scm>
+ <developers>
+ <developer>
+ <id>you</id>
+ <name>Your Name</name>
+ <url>http://your.url</url>
+ </developer>
+ </developers>
+ )

0 comments on commit 2bc13ed

Please sign in to comment.