Created
May 3, 2010 17:17
-
-
Save retronym/388334 to your computer and use it in GitHub Desktop.
mvn2sbt: quick hack to turn <dependencies> into SBT
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
object scala { | |
val version = "SCALA_VERSION$" | |
} | |
val xml = <dependencies> | |
<dependency> | |
<groupId>org.scalanlp</groupId> | |
<artifactId>scalala_${scala.version}</artifactId> | |
<version>0.3.1</version> | |
</dependency> | |
<!-- Apache Commons --> | |
<dependency> | |
<groupId>commons-io</groupId> | |
<artifactId>commons-io</artifactId> | |
<version>1.4</version> | |
</dependency> | |
<dependency> | |
<groupId>commons-lang</groupId> | |
<artifactId>commons-lang</artifactId> | |
<version>2.4</version> | |
</dependency> | |
<dependency> | |
<groupId>joda-time</groupId> | |
<artifactId>joda-time</artifactId> | |
<version>1.6</version> | |
</dependency> | |
<dependency> | |
<groupId>joda-time</groupId> | |
<artifactId>joda-time-hibernate</artifactId> | |
<version>1.1</version> | |
<exclusions> | |
<exclusion> | |
<groupId>cglib</groupId> | |
<artifactId>cglib-full</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>ehcache</groupId> | |
<artifactId>ehcache</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>antlr</groupId> | |
<artifactId>antlr</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>org.scala-lang</groupId> | |
<artifactId>scala-library</artifactId> | |
<version>${scala.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.scala-lang</groupId> | |
<artifactId>scala-compiler</artifactId> | |
<version>${scala.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.googlecode.scalaz</groupId> | |
<artifactId>scalaz-core_${scala.version}</artifactId> | |
<version>5.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.scala-tools.testing</groupId> | |
<artifactId>specs_${scala.version}</artifactId> | |
<version>1.6.5-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.7</version> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.scala-tools.testing</groupId> | |
<artifactId>test-interface</artifactId> | |
<version>0.5</version> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.scalatest</groupId> | |
<artifactId>scalatest</artifactId> | |
<version>1.0.1-for-scala-${scala.version}-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.easymock</groupId> | |
<artifactId>easymock</artifactId> | |
<version>2.5.1</version> | |
</dependency> | |
<dependency> | |
<groupId>org.easymock</groupId> | |
<artifactId>easymockclassextension</artifactId> | |
<version>2.4</version> | |
</dependency> | |
<dependency> | |
<groupId>org.scala-tools.testing</groupId> | |
<artifactId>scalacheck_${scala.version}</artifactId> | |
<version>1.7</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jmock</groupId> | |
<artifactId>jmock</artifactId> | |
<version>2.5.1</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jmock</groupId> | |
<artifactId>jmock-legacy</artifactId> | |
<version>2.5.1</version> | |
</dependency> | |
<dependency> | |
<groupId>org.mockito</groupId> | |
<artifactId>mockito-all</artifactId> | |
<version>1.8.4</version> | |
</dependency> | |
<dependency> | |
<groupId>cglib</groupId> | |
<artifactId>cglib</artifactId> | |
<version>2.1_3</version> | |
</dependency> | |
<dependency> | |
<groupId>org.objenesis</groupId> | |
<artifactId>objenesis</artifactId> | |
<version>1.0</version> | |
</dependency> | |
<dependency> | |
<groupId>net.objectlab.kit.datecalc</groupId> | |
<artifactId>datecalc-joda</artifactId> | |
<version>1.1.0</version> | |
</dependency> | |
<dependency> | |
<groupId>net.objectlab.kit.datecalc</groupId> | |
<artifactId>datecalc-common</artifactId> | |
<version>1.1.0</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.commons</groupId> | |
<artifactId>commons-math</artifactId> | |
<version>2.0</version> | |
</dependency> | |
</dependencies> | |
val data: Seq[(String, String, String)] = (xml \ "dependency") map { d => | |
val groupId = d \ "groupId" text | |
val artifactId = d \ "artifactId" text | |
val versionNum = d \ "version" text | |
(groupId, artifactId, versionNum) | |
} | |
val CrossBuildArtifact = """([\w-]+)_\$SCALA_VERSION\$""".r | |
def dep(a: String, g: String, v: String, cross: Boolean) = { | |
val sep = if (cross) "%%" else "%" | |
val ident = a.split("-").map(_.capitalize).mkString | |
"""val %s = "%s" %s "%s" %% "%s" """ format (ident, g, sep, a, v) | |
} | |
val m = data map { | |
case (g, CrossBuildArtifact(a), v) => dep(a, g, v, true) | |
case (g, a, v) => dep(a, g, v, false) | |
} mkString("\n") | |
println(m) |
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
val Scalala_$SCALA_VERSION$ = "org.scalanlp" % "scalala_$SCALA_VERSION$" % "0.3.1" | |
val CommonsIo = "commons-io" % "commons-io" % "1.4" | |
val CommonsLang = "commons-lang" % "commons-lang" % "2.4" | |
val JodaTime = "joda-time" % "joda-time" % "1.6" | |
val JodaTimeHibernate = "joda-time" % "joda-time-hibernate" % "1.1" | |
val ScalaLibrary = "org.scala-lang" % "scala-library" % "$SCALA_VERSION$" | |
val ScalaCompiler = "org.scala-lang" % "scala-compiler" % "$SCALA_VERSION$" | |
val ScalazCore_$SCALA_VERSION$ = "com.googlecode.scalaz" % "scalaz-core_$SCALA_VERSION$" % "5.0-SNAPSHOT" | |
val Specs_$SCALA_VERSION$ = "org.scala-tools.testing" % "specs_$SCALA_VERSION$" % "1.6.5-SNAPSHOT" | |
val Junit = "junit" % "junit" % "4.7" | |
val TestInterface = "org.scala-tools.testing" % "test-interface" % "0.5" | |
val Scalatest = "org.scalatest" % "scalatest" % "1.0.1-for-scala-$SCALA_VERSION$-SNAPSHOT" | |
val Easymock = "org.easymock" % "easymock" % "2.5.1" | |
val Easymockclassextension = "org.easymock" % "easymockclassextension" % "2.4" | |
val Scalacheck_$SCALA_VERSION$ = "org.scala-tools.testing" % "scalacheck_$SCALA_VERSION$" % "1.7" | |
val Jmock = "org.jmock" % "jmock" % "2.5.1" | |
val JmockLegacy = "org.jmock" % "jmock-legacy" % "2.5.1" | |
val MockitoAll = "org.mockito" % "mockito-all" % "1.8.4" | |
val Cglib = "cglib" % "cglib" % "2.1_3" | |
val Objenesis = "org.objenesis" % "objenesis" % "1.0" | |
val DatecalcJoda = "net.objectlab.kit.datecalc" % "datecalc-joda" % "1.1.0" | |
val DatecalcCommon = "net.objectlab.kit.datecalc" % "datecalc-common" % "1.1.0" | |
val CommonsMath = "org.apache.commons" % "commons-math" % "2.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment