{"id":19299986,"url":"https://github.com/cloudogu/groovy-cli-graal-nativeimage-micronaut-example","last_synced_at":"2026-05-04T18:38:58.021Z","repository":{"id":72236105,"uuid":"365324754","full_name":"cloudogu/groovy-cli-graal-nativeimage-micronaut-example","owner":"cloudogu","description":"Example CLI app written in Groovy, using micronaut, compiling into a static binary via Graal native image","archived":false,"fork":false,"pushed_at":"2022-03-23T16:00:04.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-05T22:42:02.580Z","etag":null,"topics":["cli","docker","graalvm","graalvm-native-image","groovy","maven","micronaut","picocli"],"latest_commit_sha":null,"homepage":"","language":"Batchfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudogu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-07T18:45:30.000Z","updated_at":"2022-03-22T20:03:01.000Z","dependencies_parsed_at":"2023-02-25T17:30:32.879Z","dependency_job_id":null,"html_url":"https://github.com/cloudogu/groovy-cli-graal-nativeimage-micronaut-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudogu","download_url":"https://codeload.github.com/cloudogu/groovy-cli-graal-nativeimage-micronaut-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240401337,"owners_count":19795531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","docker","graalvm","graalvm-native-image","groovy","maven","micronaut","picocli"],"created_at":"2024-11-09T23:13:21.769Z","updated_at":"2026-05-04T18:38:57.977Z","avatar_url":"https://github.com/cloudogu.png","language":"Batchfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Groovy CLI Graal Native Image Micronaut Example\n[![Push to GitHub Container Registry](https://github.com/cloudogu/groovy-cli-graal-nativeimage-micronaut-example/actions/workflows/push-ghcr.yaml/badge.svg?branch=main)](https://github.com/cloudogu/groovy-cli-graal-nativeimage-micronaut-example/actions/workflows/push-ghcr.yaml)\n\nAn example CLI app written in Groovy, using micronaut, compiling into a static binary via Graal native image.\n\n\u003e Use of GraalVM’s native-image tool is only supported in Java or Kotlin projects. Groovy relies heavily on reflection which is only partially supported by GraalVM.  \nhttps://docs.micronaut.io/2.5.1/guide/index.html#graal\n\nThis project is for those who'd like to try anyway.\n\n## Create and run image\n\nThe result can also be found at [ghcr.io/cloudogu/groovy-cli-graal-nativeimage-micronaut-example](https://ghcr.io/cloudogu/groovy-cli-graal-nativeimage-micronaut-example)\n\n```shell\n# First build takes a couple of minutes!\n$ docker build -t groovy .\n\n# Run image built locally\n$ docker run --rm groovy -v\n# Or pull and run remote image\n$ docker run --rm ghcr.io/cloudogu/groovy-cli-graal-nativeimage-micronaut-example\n\n# Interesting: Size of static Binary without additional JRE (uncompressed! on the registry it's about 1/4 the size)\n$ docker images groovy\nREPOSITORY   TAG       IMAGE ID       CREATED          SIZE\ngroovy          latest    c5f9ff7e61c6   50 minutes ago   76.9MB\n```\n\nThe build should also work without `Dockerfile` using `./mvnw package -Dpackaging=docker-native` but this fails.\nPassing the same arguments as in `Dockerfile` also fails: \n\n```shell\n# java.lang.NoClassDefFoundError: org/apache/ivy/core/module/descriptor/ModuleDescriptor\n./mvnw package -Dpackaging=docker-native \\\n  -Dmicronaut.native-image.args='-Dgroovy.grape.enable=false -H:+ReportExceptionStackTraces -H:ConfigurationFileDirectories=conf/ --static --allow-incomplete-classpath --report-unsupported-elements-at-runtime --initialize-at-run-time=org.codehaus.groovy.control.XStreamUtils,groovy.grape.GrapeIvy --initialize-at-build-time --no-server'\n```\nSo somehow some dependencies seem to be missing?!\n\n## How this example was created\n\n```\nmn create-cli-app -b maven -l groovy -t junit groovy \n```\n\nManually added\n\n* `pom.xml`: \n  * for `\u003cartifactId\u003egmavenplus-plugin\u003c/artifactId\u003e`\n    ```xml\n    \u003cconfiguration\u003e\n      \u003cconfigScript\u003ecompiler.groovy\u003c/configScript\u003e\n    \u003c/configuration\u003e\n    ```\n    * Add `maven.compiler.source` and `.target` to use JDK 11 \n* `Dockerfile` and `.dockerignore`\n* `compiler.groovy`\n* for development it would also be helpful to set the `compiler.groovy` as the config script for your IDE's groovy compiler.\n\n## Resources\n\n* When running into exceptions such as the following:\n  java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.dgm$...\n  groovy.lang.MissingMethodException: No signature of method: ...is applicable for argument types: ...\n  See \n  * [here](https://github.com/croz-ltd/klokwrk-project/blob/57202c58b792aff5f47e4c9033f91e5a31f100cc/support/documentation/article/groovy-graalvm-native-image/groovy-graalvm-native-image.md#default-groovy-methods) for a general overview and\n  * [this commit](https://github.com/cloudogu/gitops-playground/commit/2a169f661a9743938e1333fc3564a5e6f88cc4e4) for a working example\n* [More recent example: Groovy script as graal native image](https://dev.to/wololock/groovy-script-startup-time-from-2-1s-to-0-013s-with-graalvm-1p34), with [example project](https://github.com/wololock/gttp).\n  This example shows how to build a groovy script. Our example here shows how to use classes and micronaut and a build tool.\n* [Older Example on how Graal could work with Groovy](https://e.printstacktrace.blog/graalvm-and-groovy-how-to-start/), with [example project](https://github.com/wololock/graalvm-groovy-examples). \n  It also contains [Groovy Compiler Config](https://github.com/wololock/graalvm-groovy-examples/blob/master/hello-world/conf/compiler.groovy) for static compiling. Other articles also mention to add `ast(groovy.transform.TypeChecked)` to the config.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudogu%2Fgroovy-cli-graal-nativeimage-micronaut-example/lists"}