Skip to content

jooby-cli generated gradle build won't complie #3706

@ckdevlop

Description

@ckdevlop

Using the jooby-cli to generate my first Kotlin-Gradle Jooby app with the command below:

jooby> create myJoobyApp --kotlin --gradle --server=undertow

run the app :

./gradlew joobyRun

Here is the error:

...
`> Task :compileKotlin FAILED
e: file:///home/ckkhui/apps/Projects/joobyPj/testApp/src/main/kotlin/app/App.kt:5:17 Unresolved reference 'undertow'.
e: file:///home/ckkhui/apps/Projects/joobyPj/testApp/src/main/kotlin/app/App.kt:8:11 Unresolved reference 'UndertowServer'.

The problem is, the cli didn't generate dependency for undertow, instead it used the Netty dependency in gradle.build.kts, so here is the change I made to successfully run the generated jooby app:

  1. In gradle.build.kts
implementation("io.jooby:jooby-undertow")
// and remove the line below
//implementation("io.jooby:jooby-netty")

BTW, since we're already in gradle build file, the development of theshadow plugin has moved to com.gradleup.shadow, hence I made this change as well:

     id("com.gradleup.shadow") version "8.3.7"
    // id("com.github.johnrengelman.shadow") version "8.1.1"
  1. Remove the manual install in App.kt (Optional)
..
//import io.jooby.undertow.UndertowServer

..
..

class App: Kooby({
  // install(UndertowServer())
  ...
})

After these changes, I was able to run the sample app without problems.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions