{"id":24379813,"url":"https://github.com/sake92/java-build-tool-daemon-interactive","last_synced_at":"2026-04-29T03:07:02.365Z","repository":{"id":271080179,"uuid":"912333339","full_name":"sake92/java-build-tool-daemon-interactive","owner":"sake92","description":"Testing running an *interactive process* (requiring terminal user input) with gradle/maven/sbt/mill daemon. ","archived":false,"fork":false,"pushed_at":"2025-01-05T10:25:04.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-31T21:13:03.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/sake92.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":"2025-01-05T09:25:48.000Z","updated_at":"2025-02-18T13:59:26.000Z","dependencies_parsed_at":"2025-01-05T11:25:45.664Z","dependency_job_id":"3267e9b3-797c-4e42-8e88-23e28c3c028b","html_url":"https://github.com/sake92/java-build-tool-daemon-interactive","commit_stats":null,"previous_names":["sake92/java-build-tool-daemon-interactive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sake92/java-build-tool-daemon-interactive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fjava-build-tool-daemon-interactive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fjava-build-tool-daemon-interactive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fjava-build-tool-daemon-interactive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fjava-build-tool-daemon-interactive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sake92","download_url":"https://codeload.github.com/sake92/java-build-tool-daemon-interactive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sake92%2Fjava-build-tool-daemon-interactive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32408464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T02:37:21.628Z","status":"ssl_error","status_checked_at":"2026-04-29T02:36:50.947Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-01-19T07:27:46.237Z","updated_at":"2026-04-29T03:07:02.349Z","avatar_url":"https://github.com/sake92.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Java build tool daemons\n\nTesting running an *interactive process* (requiring terminal user input) with gradle/maven/sbt/mill daemon.  \nThis is the app in question:\n```java\npackage org.example;\n\nimport java.io.*;\n\npublic class App {\n    public static void main(String[] args) throws Exception {\n        System.out.println(\"Please enter: \");\n        var reader = new BufferedReader(new InputStreamReader(System.in));\n        var input = reader.readLine();\n        System.out.println(\"You entered: \" + input);\n    }\n}\n\n```\n\nSeems like most of them try to run it within the daemon itself, which seems problematic, see below.  \n**Only sbt seems to handle it properly!**\n\n\n\nA better approach maybe would be to run it within the client itself.  \nThe server would only shoot a message to the client with command line args.  \nThis also offloads the server, and implementing watch/interrupt feels easier.\n\nPOC: https://github.com/sake92/mill-client-server-poc\n\n----------\n## Maven daemon\n\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\maven\u003e mvnd compile\n...\nPS D:\\projects\\tmp\\java-build-tools\\maven\u003e mvnd exec:java\n[INFO] Processing build on daemon 226ec674\n[INFO] Scanning for projects...\n[INFO] BuildTimeEventSpy is registered.\n[INFO]\n[INFO] Using the SmartBuilder implementation with a thread count of 7\n[INFO]\n[INFO] ---------------------------\u003c ba.sake:maven \u003e----------------------------\n[INFO] Building maven 1.0-SNAPSHOT\n[INFO]   from pom.xml\n[INFO] --------------------------------[ jar ]---------------------------------\n[INFO]\n[INFO] --- exec:1.4.0:java (default-cli) @ maven ---\n[INFO] [stdout] Please enter:\n```\n\nThe input is blocked at this point.  \nBut at least you can Ctrl+C it.\n\nOf course, `mvn exec:java` works fine.\n\n-----------\n## Gradle daemon\n\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\gradle\u003e .\\gradlew run\nReusing configuration cache.\n\n\u003e Task :app:run\nPlease enter:\nYou entered: null\n\nBUILD SUCCESSFUL in 1s\n2 actionable tasks: 2 executed\nConfiguration cache entry reused.\n```\n\nGradle daemon conveniently sets your input as `null`.  \nObviously.\n\nInterestingly the no-daemon version doesn't work either!!! :oooooo\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\gradle\u003e ./gradlew --no-daemon app:run\nTo honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.12/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.\nDaemon will be stopped at the end of the build\nReusing configuration cache.\n\n\u003e Task :app:run\nPlease enter:\nYou entered: null\n\nBUILD SUCCESSFUL in 5s\n2 actionable tasks: 1 executed, 1 up-to-date\nConfiguration cache entry reused.\n```\n\n---------\n## Sbt daemon\n\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\sbt\u003e sbt --client run\n[info] Updated file D:\\projects\\tmp\\java-build-tools\\sbt\\project\\build.properties: set sbt.version to 1.9.7\n[info] welcome to sbt 1.9.7 (Eclipse Adoptium Java 21.0.1)\n[info] loading project definition from D:\\projects\\tmp\\java-build-tools\\sbt\\project\n[info] loading settings for project sbt from build.sbt ...\n[info] set current project to sbt (in build file:/D:/projects/tmp/java-build-tools/sbt/)\n[info] compiling 1 Java source to D:\\projects\\tmp\\java-build-tools\\sbt\\target\\scala-2.12\\classes ...\n[info] running org.example.App\nPlease enter:\ngdfgdf\nYou entered: gdfgdf\n[success] Total time: 4 s, completed 5. jan 2025. 10:00:08\n```\nSbt daemon works !\n\nAlthough if you run 2 commands it will block the second one:\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\sbt\u003e sbt --client run\n[info] entering *experimental* thin client - BEEP WHIRR\n[info] terminate the server with `shutdown`\n\u003e run\n```\n\n\n---------\n## Mill daemon\n\n\n```sh\nPS D:\\projects\\tmp\\java-build-tools\\mill\u003e ./mill app.run\n[build.mill-64/68] compile\n[build.mill-64] [info] compiling 1 Scala source to D:\\projects\\tmp\\java-build-tools\\mill\\out\\mill-build\\compile.dest\\classes ...\n[build.mill-64] [info] done compiling\n[47/55] app.compile\n[47] [info] compiling 1 Java source to D:\\projects\\tmp\\java-build-tools\\mill\\out\\app\\compile.dest\\classes ...\n[47] [info] done compiling\n[55/55] app.run\n[55] Please enter:\n[55] You entered: null\n[55/55] ============================= app.run ============================ 5s\n```\n\nMill daemon also conveniently sets your input as `null`.  \nObviously.\n\nThe workaround is to use mill in interactive mode: `./mill -i app.run`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsake92%2Fjava-build-tool-daemon-interactive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsake92%2Fjava-build-tool-daemon-interactive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsake92%2Fjava-build-tool-daemon-interactive/lists"}