diff --git a/config.toml b/config.toml index b9559e1..aa410af 100644 --- a/config.toml +++ b/config.toml @@ -23,6 +23,26 @@ groupId = "org.http4k" artifactId = "http4k-core" version = "3.260.0" category = "server" +default = true + +[dependencies.http4k-server-jetty] +groupId = "org.http4k" +artifactId = "http4k-server-jetty" +version = "3.260.0" +category = "server" +default = true + +[dependencies.http4k-server-apache] +groupId = "org.http4k" +artifactId = "http4k-server-apache" +version = "3.260.0" +category = "server" + +[dependencies.http4k-client-apache] +groupId = "org.http4k" +artifactId = "http4k-server-apache" +version = "3.260.0" +category = "server" [dependencies.javalin] groupId = "io.javalin" @@ -34,6 +54,7 @@ category = "server" groupId = "io.pebbletemplates" artifactId = "pebble" version = "3.1.4" +default = true [dependencies.logback] groupId = "ch.qos.logback" @@ -75,4 +96,42 @@ category = "database" groupId = "me.liuwj.ktorm" artifactId = "ktorm-support-mysql" version = "3.0.0" -category = "database" \ No newline at end of file +category = "database" + +[dependencies.junit] +groupId = "org.junit.jupiter" +artifactId = "junit-jupiter" +version = "5.6.2" +scope = "test" +category = "test" +default = true + +[dependencies.junit-params] +groupId = "org.junit.jupiter" +artifactId = "junit-jupiter-params" +version = "5.6.2" +scope = "test" +category = "test" +default = true + +[dependencies.mokk] +groupId = "io.mockk" +artifactId = "mockk" +version = "1.10.0" +scope = "test" +category = "test" + +[dependencies.hamkrest] +groupId = "com.natpryce" +artifactId = "hamkrest" +version = "1.7.0.3" +scope = "test" +category = "test" + +[dependencies.assertJ] +groupId = "org.assertj" +artifactId = "assertj-core" +version = "3.16.1" +scope = "test" +category = "test" +default = true diff --git a/src/main/kotlin/starter/Config.kt b/src/main/kotlin/starter/Config.kt index 5041821..4da85b9 100644 --- a/src/main/kotlin/starter/Config.kt +++ b/src/main/kotlin/starter/Config.kt @@ -18,7 +18,8 @@ class Config { values["artifactId"], values["version"], values.getOrElse("default", false), - values.getEnumOrElse("category", Category.Other) + values.getEnumOrElse("category", Category.Other), + values.getEnumOrElse("scope", Scope.Compile), ) } diff --git a/src/main/kotlin/starter/Models.kt b/src/main/kotlin/starter/Models.kt index 8a89511..fd21249 100644 --- a/src/main/kotlin/starter/Models.kt +++ b/src/main/kotlin/starter/Models.kt @@ -1,7 +1,11 @@ package starter enum class Category { - Server, Database, Other + Server, Database, Test, Other +} + +enum class Scope { + Compile, Test } data class Dependency( @@ -11,5 +15,7 @@ data class Dependency( val version: String, val default: Boolean, val category: Category, + val scope: Scope ) + data class Input(val name: String, val display: String, val value: String? = null) \ No newline at end of file diff --git a/src/main/kotlin/starter/Views.kt b/src/main/kotlin/starter/Views.kt index 0ee7fd9..e596a84 100644 --- a/src/main/kotlin/starter/Views.kt +++ b/src/main/kotlin/starter/Views.kt @@ -24,7 +24,7 @@ class Views(private val engine: PebbleEngine) { fun pom(dependencies: List, inputs: List): String { val args: MutableMap = mutableMapOf( - "dependencies" to dependencies, + "dependencies" to dependencies.sortedBy { it.scope }, ) inputs.forEach { diff --git a/src/main/resources/starter/@dependencies.twig b/src/main/resources/starter/@dependencies.twig index 9a9da3d..d999ec8 100644 --- a/src/main/resources/starter/@dependencies.twig +++ b/src/main/resources/starter/@dependencies.twig @@ -4,6 +4,9 @@ {{ dep.groupId }} {{ dep.artifactId }} {{ dep.version }} + {% if dep.scope.toString == "Test" %} + test + {% endif %} {% endfor %} \ No newline at end of file