{"id":19210927,"url":"https://github.com/bowbahdoe/jresolve-cli","last_synced_at":"2025-05-12T19:26:12.838Z","repository":{"id":206046864,"uuid":"715661863","full_name":"bowbahdoe/jresolve-cli","owner":"bowbahdoe","description":"CLI for resolving dependencies on the JVM","archived":false,"fork":false,"pushed_at":"2025-02-15T14:13:20.000Z","size":140,"stargazers_count":32,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T17:38:01.070Z","etag":null,"topics":["dependency-management","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bowbahdoe.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,"zenodo":null}},"created_at":"2023-11-07T15:29:05.000Z","updated_at":"2025-03-09T03:20:27.000Z","dependencies_parsed_at":"2024-04-21T05:46:50.557Z","dependency_job_id":"c23539ac-0ccc-4475-b0a2-344bd2ee1e00","html_url":"https://github.com/bowbahdoe/jresolve-cli","commit_stats":null,"previous_names":["bowbahdoe/jresolve-cli"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowbahdoe%2Fjresolve-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowbahdoe%2Fjresolve-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowbahdoe%2Fjresolve-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowbahdoe%2Fjresolve-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bowbahdoe","download_url":"https://codeload.github.com/bowbahdoe/jresolve-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253807163,"owners_count":21967306,"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":["dependency-management","java"],"created_at":"2024-11-09T13:39:50.508Z","updated_at":"2025-05-12T19:26:12.816Z","avatar_url":"https://github.com/bowbahdoe.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jresolve-cli\n\nCommand line tool for resolving dependencies on the JVM.\n\n**NOTE**: This is a very early draft of this tool. The social contract is that\nif you use it and find it useful, I will be available to help you adapt to any changes. But I will\nstill make breaking changes if I have to. Expect rough edges.\n\n## Installation\n\nThere are [packages](https://github.com/bowbahdoe/jresolve-cli/actions)\ngenerated in CI which can be added to your path. Click on the latest workflow run and there should be downloads at the\nbottom of the page.\n\nFor M1 Macs, GitHub does not provide an executor with a compatible CPU, so I'm building\nthose locally for now. Shoot me a message and I can send you an exe or you can build locally if\nyou have maven, [just](https://github.com/casey/just), and [native-image](https://www.graalvm.org/22.0/reference-manual/native-image/) on your machine.\n\nFor Mac and Linux you can install a version that depends on having Java 21+ installed\nwith the following command.\n\n```\nbash \u003c \u003c(curl -s  https://raw.githubusercontent.com/bowbahdoe/jresolve-cli/main/install)\n```\n\nVery much a work in progress.\n\n## Usage\n\nThe concept is that you provide a \"[package url](https://github.com/package-url/purl-spec)\"\nfor every dependency you want to have at runtime. The tool will then output\na path containing those dependencies as well as any transitive dependencies.\n\n### Simple Dependencies\n\nFor a simple dependency like `commons-collections4`, you will get a path\nto its jar.\n\n\n```\njresolve pkg:maven/org.apache.commons/commons-collections4@4.4\n```\n\n```\n/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar\n```\n\n### Transitive Dependencies\n\nFor dependencies like `jdbi3-postgres`, which have dependencies of their own,\nyou will get a path containing the jars of the entire dependency tree.\n\n```\njresolve pkg:maven/org.jdbi/jdbi3-postgres@3.41.3\n```\n\n```\n/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.22.0/error_prone_annotations-2.22.0.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/checkerframework/checker-qual/3.38.0/checker-qual-3.38.0.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/io/leangen/geantyref/geantyref/1.3.14/geantyref-1.3.14.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/jdbi/jdbi3-core/3.41.3/jdbi3-core-3.41.3.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/jdbi/jdbi3-postgres/3.41.3/jdbi3-postgres-3.41.3.jar\n```\n\n### Multiple dependencies\n\nIf you have more than one dependency, you can provide them one after another on the command line.\n\n```\njresolve pkg:maven/org.apache.commons/commons-collections4@4.4 \\\n         pkg:maven/org.junit.jupiter/junit-jupiter-api@5.10.1\n```\n\n```\n/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/1.10.1/junit-platform-commons-1.10.1.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.10.1/junit-jupiter-api-5.10.1.jar\n```\n\nOr you can put them all into a file separated by newlines.\n\n`deps`:\n\n```\npkg:maven/org.apache.commons/commons-collections4@4.4\npkg:maven/org.junit.jupiter/junit-jupiter-api@5.10.1\n```\n\nThen you can use that as an argfile. Put `@` before the filename and the args will\nexpand out.\n\n```\njresolve @deps\n```\n\n### Multiple sets of dependencies\n\nIf you have sets of dependencies which are available at different points in\nyour project's lifecycle, you can use multiple argfiles for them.\n\n#### Compile Time\n\n```\njresolve @deps/compile\n```\n\n#### Run Time\n\n(includes both compile and runtime dependencies)\n```\njresolve @deps/compile @deps/runtime\n```\n\n### Usage from JVM Tools\n\nIf you want to pass the result of a dependency resolution to tools like `javac` you have a few options\n\nThe first is that, if your shell supports it, you can use the output of the tool inline\nwith an invocation.\n\n```\njava --class-path $(jresolve @deps) src/Main.java\n```\n\nThe more portable option is to run the tool and put the results into a file.\n\n```\njresolve --output-file build/argfiles/runtime @deps/compile @deps/runtime\n```\n\nAnd then use the argfile when invoking the tool.\n\n```\njava --class-path @build/argfiles/runtime src/Main.java\n```\n\nMost tools in the JVM support expanding arguments from argfiles with `@`, but there\nare some exceptions. A notable one is `jshell`, for some reason.\n\n### Including file paths\n\nIf you need to include a path to a specific file or folder in your final `--class-path` or `--module-path`\nyou can do that in one of two ways.\n\nThe first is to include it as-is. Anything that cannot be parsed as a URL will be forwarded directly\nto the final path.\n\n```\njresolve pkg:maven/org.apache.commons/commons-collections4@4.4 some/other/path\n```\n\n```\n/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar:some/other/path\n```\n\n\nThe second is to supply it as an argument with a `file:///` url. Keep in mind that such urls\nare always absolute paths and as such likely won't be portable to other machines.\n\n```\njresolve pkg:maven/org.apache.commons/commons-collections4@4.4 file:///an/absolute/path\n```\n\n```\n/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar:/an/absolute/path\n```\n\n\n### Including remote files\n\nIf you need to include files hosted on some remote source, there is limited support for that.\nIf you provide an `https://` url, that file will be downloaded and put onto the final path.\n\nThere is no support for, and no plans to support, files hosted via other protocols like `tcp` or `http`\nor to support getting files behind urls which require authentication.\n\n```\njresolve https://piston-data.mojang.com/v1/objects/5b868151bd02b41319f54c8d4061b8cae84e665c/server.jar\n```\n\n### Usage to make a project\n\nIf you are curious what it would look like to make an actual project using this\nand other JVM tools instead of a full build system, there is a demo of that [here](https://github.com/bowbahdoe/jresolve-example-simple/tree/main).\n\nGetting IDEs to recognize what dependencies are made available is unsolved, but definitely solvable.\n\n### Custom maven repositories\n\nIf you make a json file like this\n\n```json \n{\n  \"jitpack\": {\n    \"url\": \"https://jitpack.io\"\n  }\n}\n```\n\nYou can supply it to the tool\n\n```\njresolve --maven-repositories-file repositories.json @deps\n```\n\nAnd include the repository to use on a specific coordinate.\n\n```\npkg:maven/com.github.thegatesdev/maple@4.0.0?repository=jitpack\n```\n\n### Custom maven repositories with authentication\n\nTo use a repository that requires username + password authentication,\ninclude an object with those credentials in your json file.\n\n```json \n{\n  \"jitpack\": {\n    \"url\": \"https://jitpack.io\",\n    \"authentication\": {\n      \"username\": \"bob\",\n      \"password\": \"123\"\n    }\n  }\n}\n```\n\n\n## Anticipated Questions\n\n\n### Why package urls?\n\nIt is annoying to write `pkg:maven` in front of everything. It also makes the syntax for overriding\nproperties of dependencies a bit wonky - `?repository=jitpack` and such.\n\nThose are the downsides. The upside is that it is possible to support other kinds of dependency declarations.\nThe underlying resolver is based on [tools.deps](https://github.com/clojure/tools.deps) and is agnostic to maven.\nIt should be relatively straightforward to add support for git dependencies (without going through jitpack), local \ndependencies (not just files, but locally developed projects with their own dependency manifests), and whatever\nelse is relevant.\n\n### Why not _just_ use maven/gradle/ivy\n\nShort answer\n\n* Maven lags behind in its support for JVM tools, this approach is more generically composable.\nTons of pros and cons to that.\n* Gradle is similar, but also ties itself to Groovy and Kotlin. I'm pretty sick of having to tell people to\nlearn two languages in order to learn Java.\n* Ivy is technically very generic, but it suffers greatly from being made in the days of XML and Ant.\n* I wanted to make something which is directly usable with the upcoming [Multi-File Source-Code Programs](https://bugs.openjdk.org/browse/JDK-8304400)\n* I want to make the \"command line flow\" actually practical instead of a strange joke we play on early students before saying \"sike!\"\nand giving them maven or gradle.\n\nElaboration available upon request.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbowbahdoe%2Fjresolve-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbowbahdoe%2Fjresolve-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbowbahdoe%2Fjresolve-cli/lists"}