ofStringBean) {
+ this.ofStringBean = ofStringBean;
+ }
+}
diff --git a/config/src/test/resources/beanconfig/beanconfig01.conf b/config/src/test/resources/beanconfig/beanconfig01.conf
index 791553de..2a2ea2ed 100644
--- a/config/src/test/resources/beanconfig/beanconfig01.conf
+++ b/config/src/test/resources/beanconfig/beanconfig01.conf
@@ -101,5 +101,31 @@
"valueObject": {
"mandatoryValue": "notNull"
}
+ },
+ "sets" : {
+ "empty" : [],
+ "ofInt" : [1, 2, 3, 2, 3],
+ "ofString" : [ ${strings.a}, ${strings.b}, ${strings.c} ],
+ "of-double" : [3.14, 4.14, 4.14, 5.14],
+ "of-long" : { "1" : 32, "2" : 42, "3" : 52 }, // object-to-list conversion
+ "ofNull" : [null, null, null],
+ "ofBoolean" : [true, false, false],
+ "ofArray" : [${arrays.ofString}, ${arrays.ofString}, ${arrays.ofString}],
+ "ofObject" : [${numbers}, ${booleans}, ${strings}],
+ "ofConfig" : [${numbers}, ${booleans}, ${strings}],
+ "ofConfigObject" : [${numbers}, ${booleans}, ${strings}],
+ "ofConfigValue" : [1, 2, "a"],
+ "ofDuration" : [1, 2h, 3 days],
+ "ofMemorySize" : [1024, 1M, 1G],
+ "ofStringBean" : [
+ {
+ abcd : "testAbcdOne"
+ yes : "testYesOne"
+ },
+ {
+ abcd : "testAbcdTwo"
+ yes : "testYesTwo"
+ }
+ ]
}
}
diff --git a/config/src/test/resources/test01.conf b/config/src/test/resources/test01.conf
index 1370bf85..e40eb7f5 100644
--- a/config/src/test/resources/test01.conf
+++ b/config/src/test/resources/test01.conf
@@ -65,6 +65,14 @@
"minusLargeNanos" : -4878955355435272204ns
},
+ "periods" : {
+ "day" : 1d,
+ "dayAsNumber": 2,
+ "week": 3 weeks,
+ "month": 5 mo,
+ "year": 8y
+ },
+
"memsizes" : {
"meg" : 1M,
"megsList" : [1M, 1024K, 1048576],
diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigBeanFactoryTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigBeanFactoryTest.scala
index c6d62782..00e5a093 100644
--- a/config/src/test/scala/com/typesafe/config/impl/ConfigBeanFactoryTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/ConfigBeanFactoryTest.scala
@@ -132,6 +132,39 @@ class ConfigBeanFactoryTest extends TestUtils {
assertEquals(List(stringsConfigOne, stringsConfigTwo).asJava, beanConfig.getOfStringBean)
}
+ @Test
+ def testCreateSet() {
+ val beanConfig: SetsConfig = ConfigBeanFactory.create(loadConfig().getConfig("sets"), classOf[SetsConfig])
+ assertNotNull(beanConfig)
+ assertEquals(Set().asJava, beanConfig.getEmpty)
+ assertEquals(Set(1, 2, 3).asJava, beanConfig.getOfInt)
+ assertEquals(Set(32L, 42L, 52L).asJava, beanConfig.getOfLong)
+ assertEquals(Set("a", "b", "c").asJava, beanConfig.getOfString)
+ assertEquals(3, beanConfig.getOfObject.size)
+ assertEquals(3, beanConfig.getOfDouble.size)
+ assertEquals(3, beanConfig.getOfConfig.size)
+ assertTrue(beanConfig.getOfConfig.iterator().next().isInstanceOf[Config])
+ assertEquals(3, beanConfig.getOfConfigObject.size)
+ assertTrue(beanConfig.getOfConfigObject.iterator().next().isInstanceOf[ConfigObject])
+ assertEquals(Set(intValue(1), intValue(2), stringValue("a")),
+ beanConfig.getOfConfigValue.asScala)
+ assertEquals(Set(Duration.ofMillis(1), Duration.ofHours(2), Duration.ofDays(3)),
+ beanConfig.getOfDuration.asScala)
+ assertEquals(Set(ConfigMemorySize.ofBytes(1024),
+ ConfigMemorySize.ofBytes(1048576),
+ ConfigMemorySize.ofBytes(1073741824)),
+ beanConfig.getOfMemorySize.asScala)
+
+ val stringsConfigOne = new StringsConfig();
+ stringsConfigOne.setAbcd("testAbcdOne")
+ stringsConfigOne.setYes("testYesOne")
+ val stringsConfigTwo = new StringsConfig();
+ stringsConfigTwo.setAbcd("testAbcdTwo")
+ stringsConfigTwo.setYes("testYesTwo")
+
+ assertEquals(Set(stringsConfigOne, stringsConfigTwo).asJava, beanConfig.getOfStringBean)
+ }
+
@Test
def testCreateDuration() {
val beanConfig: DurationsConfig = ConfigBeanFactory.create(loadConfig().getConfig("durations"), classOf[DurationsConfig])
@@ -237,6 +270,14 @@ class ConfigBeanFactoryTest extends TestUtils {
assertTrue("error about the right property", e.getMessage.contains("'map'"))
}
+ @Test
+ def testDifferentFieldNameFromAccessors(): Unit = {
+ val e = intercept[ConfigException.ValidationFailed] {
+ ConfigBeanFactory.create(ConfigFactory.empty(), classOf[DifferentFieldNameFromAccessorsConfig])
+ }
+ assertTrue("only one missing value error", e.getMessage.contains("No setting"))
+ }
+
private def loadConfig(): Config = {
val configIs: InputStream = this.getClass().getClassLoader().getResourceAsStream("beanconfig/beanconfig01.conf")
try {
diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigDocumentTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigDocumentTest.scala
index a9323cdb..1106f604 100644
--- a/config/src/test/scala/com/typesafe/config/impl/ConfigDocumentTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/ConfigDocumentTest.scala
@@ -292,7 +292,7 @@ class ConfigDocumentTest extends TestUtils {
@Test
def configDocumentFileParse {
val configDocument = ConfigDocumentFactory.parseFile(resourceFile("/test03.conf"))
- val fileReader = new BufferedReader(new FileReader("config/src/test/resources/test03.conf"))
+ val fileReader = new BufferedReader(new FileReader("src/test/resources/test03.conf"))
var line = fileReader.readLine()
val sb = new StringBuilder()
while (line != null) {
diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala
index 7cc79e59..712e1c43 100644
--- a/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala
@@ -10,6 +10,7 @@ import com.typesafe.config.ConfigException
import com.typesafe.config.ConfigResolveOptions
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
+import scala.collection.JavaConverters._
class ConfigSubstitutionTest extends TestUtils {
@@ -723,6 +724,35 @@ class ConfigSubstitutionTest extends TestUtils {
checkNotSerializable(substComplexObject)
}
+ @Test
+ def resolveListFromSystemProps() {
+ val props = parseObject(
+ """
+ |"a": ${testList}
+ """.stripMargin)
+
+ System.setProperty("testList.0", "0")
+ System.setProperty("testList.1", "1")
+ ConfigImpl.reloadSystemPropertiesConfig()
+
+ val resolved = resolve(ConfigFactory.systemProperties().withFallback(props).root.asInstanceOf[AbstractConfigObject])
+
+ assertEquals(List("0", "1"), resolved.getList("a").unwrapped().asScala)
+ }
+
+ @Test
+ def resolveListFromEnvVars() {
+ val props = parseObject(
+ """
+ |"a": ${testList}
+ """.stripMargin)
+
+ //"testList.0" and "testList.1" are defined as envVars in build.sbt
+ val resolved = resolve(props)
+
+ assertEquals(List("0", "1"), resolved.getList("a").unwrapped().asScala)
+ }
+
// this is a weird test, it used to test fallback to system props which made more sense.
// Now it just tests that if you override with system props, you can use system props
// in substitutions.
diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala
index d88b365c..0becca4b 100644
--- a/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/ConfigTest.scala
@@ -3,13 +3,16 @@
*/
package com.typesafe.config.impl
+import java.time.temporal.{ ChronoUnit, TemporalUnit }
+
import org.junit.Assert._
import org.junit._
import com.typesafe.config._
import java.util.concurrent.TimeUnit
+
import scala.collection.JavaConverters._
import com.typesafe.config.ConfigResolveOptions
-import java.util.concurrent.TimeUnit.{ SECONDS, NANOSECONDS, MICROSECONDS, MILLISECONDS, MINUTES, DAYS, HOURS }
+import java.util.concurrent.TimeUnit.{ DAYS, HOURS, MICROSECONDS, MILLISECONDS, MINUTES, NANOSECONDS, SECONDS }
class ConfigTest extends TestUtils {
@@ -811,6 +814,13 @@ class ConfigTest extends TestUtils {
assertDurationAsTimeUnit(HOURS)
assertDurationAsTimeUnit(DAYS)
+ // periods
+ assertEquals(1, conf.getPeriod("periods.day").get(ChronoUnit.DAYS))
+ assertEquals(2, conf.getPeriod("periods.dayAsNumber").getDays)
+ assertEquals(3 * 7, conf.getTemporal("periods.week").get(ChronoUnit.DAYS))
+ assertEquals(5, conf.getTemporal("periods.month").get(ChronoUnit.MONTHS))
+ assertEquals(8, conf.getTemporal("periods.year").get(ChronoUnit.YEARS))
+
// should get size in bytes
assertEquals(1024 * 1024L, conf.getBytes("memsizes.meg"))
assertEquals(1024 * 1024L, conf.getBytes("memsizes.megAsNumber"))
@@ -1233,4 +1243,70 @@ class ConfigTest extends TestUtils {
val resolved = unresolved.resolveWith(source)
assertEquals(43, resolved.getInt("foo"))
}
+
+ /**
+ * A resolver that replaces paths that start with a particular prefix with
+ * strings where that prefix has been replaced with another prefix.
+ */
+ class DummyResolver(prefix: String, newPrefix: String, fallback: ConfigResolver) extends ConfigResolver {
+
+ override def lookup(path: String): ConfigValue = {
+ if (path.startsWith(prefix))
+ ConfigValueFactory.fromAnyRef(newPrefix + path.substring(prefix.length))
+ else if (fallback != null)
+ fallback.lookup(path)
+ else
+ null
+ }
+
+ override def withFallback(f: ConfigResolver): ConfigResolver = {
+ if (fallback == null)
+ new DummyResolver(prefix, newPrefix, f)
+ else
+ new DummyResolver(prefix, newPrefix, fallback.withFallback(f))
+ }
+
+ }
+
+ private def runFallbackTest(expected: String, source: String,
+ allowUnresolved: Boolean, resolvers: ConfigResolver*) = {
+ val unresolved = ConfigFactory.parseString(source)
+ var options = ConfigResolveOptions.defaults().setAllowUnresolved(allowUnresolved)
+ for (resolver <- resolvers)
+ options = options.appendResolver(resolver)
+ val obj = unresolved.resolve(options).root()
+ assertEquals(expected, obj.render(ConfigRenderOptions.concise().setJson(false)))
+ }
+
+ @Test
+ def resolveFallback(): Unit = {
+ runFallbackTest(
+ "x=a,y=b",
+ "x=${a},y=${b}", false,
+ new DummyResolver("", "", null))
+ runFallbackTest(
+ "x=\"a.b.c\",y=\"a.b.d\"",
+ "x=${a.b.c},y=${a.b.d}", false,
+ new DummyResolver("", "", null))
+ runFallbackTest(
+ "x=${a.b.c},y=${a.b.d}",
+ "x=${a.b.c},y=${a.b.d}", true,
+ new DummyResolver("x.", "", null))
+ runFallbackTest(
+ "x=${a.b.c},y=\"e.f\"",
+ "x=${a.b.c},y=${d.e.f}", true,
+ new DummyResolver("d.", "", null))
+ runFallbackTest(
+ "w=\"Y.c.d\",x=${a},y=\"X.b\",z=\"Y.c\"",
+ "x=${a},y=${a.b},z=${a.b.c},w=${a.b.c.d}", true,
+ new DummyResolver("a.b.", "Y.", null),
+ new DummyResolver("a.", "X.", null))
+
+ runFallbackTest("x=${a.b.c}", "x=${a.b.c}", true, new DummyResolver("x.", "", null))
+ val e = intercept[ConfigException.UnresolvedSubstitution] {
+ runFallbackTest("x=${a.b.c}", "x=${a.b.c}", false, new DummyResolver("x.", "", null))
+ }
+ assertTrue(e.getMessage.contains("${a.b.c}"))
+ }
+
}
diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigValueTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigValueTest.scala
index 059c1cad..50add678 100644
--- a/config/src/test/scala/com/typesafe/config/impl/ConfigValueTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/ConfigValueTest.scala
@@ -279,6 +279,23 @@ class ConfigValueTest extends TestUtils {
assertTrue(b.root.toConfig eq b)
}
+ /**
+ * Reproduces the issue #461.
+ *
+ * We use a custom de-/serializer that encodes String objects in a JDK-incompatible way. Encoding used here
+ * is rather simplistic: a long indicating the length in bytes (JDK uses a variable length integer) followed
+ * by the string's bytes. Running this test with the original SerializedConfigValue.readExternal()
+ * implementation results in an EOFException thrown during deserialization.
+ */
+ @Test
+ def configConfigCustomSerializable() {
+ val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3)
+ val expected = new SimpleConfigObject(fakeOrigin(), aMap).toConfig
+ val actual = checkSerializableWithCustomSerializer(expected)
+
+ assertEquals(expected, actual)
+ }
+
@Test
def configListEquality() {
val aScalaSeq = Seq(1, 2, 3) map { intValue(_): AbstractConfigValue }
diff --git a/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala b/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala
index 70870c66..7d63026f 100644
--- a/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala
@@ -7,8 +7,7 @@ import org.junit.Assert._
import org.junit._
import scala.collection.JavaConverters._
import com.typesafe.config._
-import java.util.Collections
-import java.util.TreeSet
+import java.util.{ Collections, TimeZone, TreeSet }
import java.io.File
import scala.collection.mutable
import equiv03.SomethingInEquiv03
@@ -17,6 +16,15 @@ import java.net.URL
import java.time.Duration
class PublicApiTest extends TestUtils {
+
+ @Before
+ def before(): Unit = {
+ // TimeZone.getDefault internally invokes System.setProperty("user.timezone", ) and it may
+ // cause flaky tests depending on tests order and jvm options. This method is invoked
+ // eg. by URLConnection.getContentType (it reads headers and gets default time zone).
+ TimeZone.getDefault
+ }
+
@Test
def basicLoadAndGet() {
val conf = ConfigFactory.load("test01")
@@ -1016,8 +1024,8 @@ class PublicApiTest extends TestUtils {
assertTrue("invalidate caches works on changed system props sys", sys2 ne sys3)
assertTrue("invalidate caches works on changed system props conf", conf2 ne conf3)
- assertTrue("invalidate caches doesn't change value if no system prop changes sys", sys1 == sys2)
- assertTrue("invalidate caches doesn't change value if no system prop changes conf", conf1 == conf2)
+ assertEquals("invalidate caches doesn't change value if no system prop changes sys", sys1, sys2)
+ assertEquals("invalidate caches doesn't change value if no system prop changes conf", conf1, conf2)
assertTrue("test system property is set sys", sys3.hasPath("invalidateCachesTest"))
assertTrue("test system property is set conf", conf3.hasPath("invalidateCachesTest"))
diff --git a/config/src/test/scala/com/typesafe/config/impl/TestUtils.scala b/config/src/test/scala/com/typesafe/config/impl/TestUtils.scala
index cae20535..13ccd160 100644
--- a/config/src/test/scala/com/typesafe/config/impl/TestUtils.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/TestUtils.scala
@@ -16,6 +16,8 @@ import java.io.ObjectOutputStream
import java.io.ByteArrayInputStream
import java.io.ObjectInputStream
import java.io.NotSerializableException
+import java.io.OutputStream
+import java.io.InputStream
import scala.annotation.tailrec
import java.net.URL
import java.util.Locale
@@ -721,7 +723,7 @@ abstract trait TestUtils {
def path(elements: String*) = new Path(elements: _*)
val resourceDir = {
- val f = new File("config/src/test/resources")
+ val f = new File("src/test/resources")
if (!f.exists()) {
val here = new File(".").getAbsolutePath
throw new Exception(s"Tests must be run from the root project directory containing ${f.getPath()}, however the current directory is $here")
@@ -871,7 +873,7 @@ abstract trait TestUtils {
}
protected def withScratchDirectory[T](testcase: String)(body: File => T): Unit = {
- val target = new File("config/target")
+ val target = new File("target")
if (!target.isDirectory)
throw new RuntimeException(s"Expecting $target to exist")
val suffix = java.lang.Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current.nextInt)
@@ -883,4 +885,32 @@ abstract trait TestUtils {
deleteRecursive(scratch)
}
}
+
+ protected def checkSerializableWithCustomSerializer[T: Manifest](o: T): T = {
+ val byteStream = new ByteArrayOutputStream()
+ val objectStream = new CustomObjectOutputStream(byteStream)
+ objectStream.writeObject(o)
+ objectStream.close()
+ val inStream = new ByteArrayInputStream(byteStream.toByteArray)
+ val inObjectStream = new CustomObjectInputStream(inStream)
+ val copy = inObjectStream.readObject()
+ inObjectStream.close()
+ copy.asInstanceOf[T]
+ }
+
+ class CustomObjectOutputStream(out: OutputStream) extends ObjectOutputStream(out) {
+ override def writeUTF(str: String): Unit = {
+ val bytes = str.getBytes
+ writeLong(bytes.length)
+ write(bytes)
+ }
+ }
+
+ class CustomObjectInputStream(in: InputStream) extends ObjectInputStream(in) {
+ override def readUTF(): String = {
+ val bytes = new Array[Byte](readLong().toByte)
+ read(bytes)
+ new String(bytes)
+ }
+ }
}
diff --git a/config/src/test/scala/com/typesafe/config/impl/UnitParserTest.scala b/config/src/test/scala/com/typesafe/config/impl/UnitParserTest.scala
index b4ee9a1b..f03593d1 100644
--- a/config/src/test/scala/com/typesafe/config/impl/UnitParserTest.scala
+++ b/config/src/test/scala/com/typesafe/config/impl/UnitParserTest.scala
@@ -3,6 +3,9 @@
*/
package com.typesafe.config.impl
+import java.time.{ LocalDate, Period }
+import java.time.temporal.ChronoUnit
+
import org.junit.Assert._
import org.junit._
import com.typesafe.config._
@@ -40,6 +43,33 @@ class UnitParserTest extends TestUtils {
assertTrue(e2.getMessage.contains("duration number"))
}
+ @Test
+ def parsePeriod() = {
+ val oneYears = List(
+ "1y", "1 y", "1year", "1 years", " 1y ", " 1 y ",
+ "365", "365d", "365 d", "365 days", " 365 days ", "365day",
+ "12m", "12mo", "12 m", " 12 mo ", "12 months", "12month")
+ val epochDate = LocalDate.ofEpochDay(0)
+ val oneYear = ChronoUnit.DAYS.between(epochDate, epochDate.plus(Period.ofYears(1)))
+ for (y <- oneYears) {
+ val period = SimpleConfig.parsePeriod(y, fakeOrigin(), "test")
+ val dayCount = ChronoUnit.DAYS.between(epochDate, epochDate.plus(period))
+ assertEquals(oneYear, dayCount)
+ }
+
+ // bad units
+ val e = intercept[ConfigException.BadValue] {
+ SimpleConfig.parsePeriod("100 dollars", fakeOrigin(), "test")
+ }
+ assertTrue(s"${e.getMessage} was not the expected error message", e.getMessage.contains("time unit"))
+
+ // bad number
+ val e2 = intercept[ConfigException.BadValue] {
+ SimpleConfig.parsePeriod("1 00 seconds", fakeOrigin(), "test")
+ }
+ assertTrue(s"${e2.getMessage} was not the expected error message", e2.getMessage.contains("time unit 'seconds'"))
+ }
+
// https://github.com/typesafehub/config/issues/117
// this broke because "1d" is a valid double for parseDouble
@Test
diff --git a/project/Build.scala b/project/Build.scala
deleted file mode 100644
index 00d33767..00000000
--- a/project/Build.scala
+++ /dev/null
@@ -1,119 +0,0 @@
-import sbt._
-import Keys._
-import com.etsy.sbt.checkstyle.CheckstylePlugin.autoImport._
-import com.typesafe.sbt.osgi.SbtOsgi
-import com.typesafe.sbt.osgi.SbtOsgi.autoImport._
-import com.typesafe.sbt.JavaVersionCheckPlugin.autoImport._
-
-object ConfigBuild extends Build {
- val unpublished = Seq(
- // no artifacts in this project
- publishArtifact := false,
- // make-pom has a more specific publishArtifact setting already
- // so needs specific override
- publishArtifact in makePom := false,
- // no docs to publish
- publishArtifact in packageDoc := false,
- // can't seem to get rid of ivy files except by no-op'ing the entire publish task
- publish := {},
- publishLocal := {}
- )
-
- object sonatype extends PublishToSonatype {
- def projectUrl = "https://github.com/typesafehub/config"
- def developerId = "havocp"
- def developerName = "Havoc Pennington"
- def developerUrl = "http://ometer.com/"
- def scmUrl = "git://github.com/typesafehub/config.git"
- }
-
- override val settings = super.settings ++ Seq(isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT"))
-
- lazy val commonSettings: Seq[Setting[_]] = unpublished ++ Seq(javaVersionPrefix in javaVersionCheck := None)
-
- lazy val rootSettings: Seq[Setting[_]] =
- commonSettings ++
- Seq(aggregate in doc := false,
- doc := (doc in (configLib, Compile)).value,
- aggregate in packageDoc := false,
- packageDoc := (packageDoc in (configLib, Compile)).value,
- aggregate in checkstyle := false,
- checkstyle := (checkstyle in (configLib, Compile)).value)
-
- lazy val root = Project(id = "root",
- base = file("."),
- settings = rootSettings) aggregate(testLib, configLib,
- simpleLibScala, simpleAppScala, complexAppScala,
- simpleLibJava, simpleAppJava, complexAppJava)
-
- lazy val configLib = Project(id = "config",
- base = file("config"),
- settings =
- sonatype.settings ++
- osgiSettings ++
- Seq(
- OsgiKeys.exportPackage := Seq("com.typesafe.config", "com.typesafe.config.impl"),
- publish := sys.error("use publishSigned instead of plain publish"),
- publishLocal := sys.error("use publishLocalSigned instead of plain publishLocal")
- )).enablePlugins(SbtOsgi) dependsOn testLib % "test->test"
-
- def project(id: String, base: File) = Project(id, base, settings = commonSettings)
-
- lazy val testLib = project("config-test-lib", file("test-lib"))
-
- lazy val simpleLibScala = project("config-simple-lib-scala", file("examples/scala/simple-lib")) dependsOn configLib
- lazy val simpleAppScala = project("config-simple-app-scala", file("examples/scala/simple-app")) dependsOn simpleLibScala
- lazy val complexAppScala = project("config-complex-app-scala", file("examples/scala/complex-app")) dependsOn simpleLibScala
-
- lazy val simpleLibJava = project("config-simple-lib-java", file("examples/java/simple-lib")) dependsOn configLib
- lazy val simpleAppJava = project("config-simple-app-java", file("examples/java/simple-app")) dependsOn simpleLibJava
- lazy val complexAppJava = project("config-complex-app-java", file("examples/java/complex-app")) dependsOn simpleLibJava
-}
-
-// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala
-
-abstract class PublishToSonatype {
- val ossSnapshots = "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
- val ossStaging = "Sonatype OSS Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
-
- def projectUrl: String
- def developerId: String
- def developerName: String
- def developerUrl: String
-
- def licenseName = "Apache License, Version 2.0"
- def licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
- def licenseDistribution = "repo"
- def scmUrl: String
- def scmConnection = "scm:git:" + scmUrl
-
- def generatePomExtra: xml.NodeSeq = {
- { projectUrl }
-
-
- { licenseName }
- { licenseUrl }
- { licenseDistribution }
-
-
-
- { scmUrl }
- { scmConnection }
-
-
-
- { developerId }
- { developerName }
- { developerUrl }
-
-
- }
-
- def settings: Seq[Setting[_]] = Seq(
- publishMavenStyle := true,
- publishTo <<= isSnapshot { (snapshot) => Some(if (snapshot) ossSnapshots else ossStaging) },
- publishArtifact in Test := false,
- pomIncludeRepository := (_ => false),
- pomExtra := generatePomExtra
- )
-}
diff --git a/project/PublishToSonatype.scala b/project/PublishToSonatype.scala
new file mode 100644
index 00000000..b6b7ca54
--- /dev/null
+++ b/project/PublishToSonatype.scala
@@ -0,0 +1,48 @@
+import sbt._, Keys._
+
+// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala
+abstract class PublishToSonatype {
+ val ossSnapshots = "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
+ val ossStaging = "Sonatype OSS Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+
+ def projectUrl: String
+ def developerId: String
+ def developerName: String
+ def developerUrl: String
+
+ def licenseName = "Apache License, Version 2.0"
+ def licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
+ def licenseDistribution = "repo"
+ def scmUrl: String
+ def scmConnection = "scm:git:" + scmUrl
+
+ def generatePomExtra: xml.NodeSeq = {
+ { projectUrl }
+
+
+ { licenseName }
+ { licenseUrl }
+ { licenseDistribution }
+
+
+
+ { scmUrl }
+ { scmConnection }
+
+
+
+ { developerId }
+ { developerName }
+ { developerUrl }
+
+
+ }
+
+ def settings: Seq[Setting[_]] = Seq(
+ publishMavenStyle := true,
+ publishTo := Some(if (isSnapshot.value) ossSnapshots else ossStaging),
+ publishArtifact in Test := false,
+ pomIncludeRepository := (_ => false),
+ pomExtra := generatePomExtra
+ )
+}
diff --git a/project/build.properties b/project/build.properties
index 43b8278c..c091b86c 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.11
+sbt.version=0.13.16