micronaut-core
micronaut-core copied to clipboard
Creating a cli-app with http-client using groovy does not compile with error "Error starting type visitor"
Using mn command line to create a simple cli app with the http-client feature and groovy but fails to compile.
Very easy to reproduce:
jmorris@jmlinux:~$ mn create-cli-app -f http-client -l groovy demo_mn | Application created at /home/jmorris/demo_mn jmorris@jmlinux:~~$ cd demo_mn jmorris@jmlinux:~/demo_mn$ ./gradlew run
Task :compileGroovy FAILED startup failed: /home/jmorris/demo_mn/src/main/groovy/demo_mn/Demo_mnCommand.groovy: Error starting type visitor [io.micronaut.validation.routes.RouteValidationVisitor@5bf3c557]: io/micronaut/http/server/types/files/StreamedFile
1 error
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':compileGroovy'.
Compilation failed; see the compiler error output for details.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 3s 1 actionable task: 1 executed_
Additional to 3.5.2, I tested 3.3.4, 3.2.7, 2.5.13, 2.4.4, 2.3.4, 2.2.3. All shows the same error.
Had to go back to 2.1.4 in order to have a project that compile.
Environment Information
- Operating System: ubuntu 20.04
- Micronaut Version:: mn --version Micronaut Version: 3.5.2
- JDK Version: openjdk 11.0.12 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)
A partner found that commenting the dependency on build.gradle:
compileOnly("io.micronaut:micronaut-http-validation")
Solves the compilation problem.
We are implementing the CLI without any further problem.
I have no idea what does that dependency, will check if we need that at all.
Thanks for the report. I've looked at the issue and the cause is that in the processor classpath, the micronaut-http-server dependency is missing, even though it is a transitive implementation dependency of http-processor-netty. I think this is a bug in the gradle groovy plugin, so I've made a bug report with gradle: https://github.com/gradle/gradle/issues/21539
btw as a workaround you can also add this to your dependencies: compileOnly("io.micronaut:micronaut-http-server")
As the name suggests this is compile only, so it does not add the dependency at runtime, but it fixes the issue.