Title: Ship the formatter jar inside the Gradle plugin instead of resolving it from the root project · Issue #20 · openjavaformat/open-java-format · GitHub
Open Graph Title: Ship the formatter jar inside the Gradle plugin instead of resolving it from the root project · Issue #20 · openjavaformat/open-java-format
X Title: Ship the formatter jar inside the Gradle plugin instead of resolving it from the root project · Issue #20 · openjavaformat/open-java-format
Description: What happens The formatter is not part of the plugin. PalantirJavaFormatProviderPlugin creates the palantirJavaFormat configuration in the root project, with a default dependency on dev.openjavaformat:open-java-format:
Open Graph Description: What happens The formatter is not part of the plugin. PalantirJavaFormatProviderPlugin creates the palantirJavaFormat configuration in the root project, with a default dependency on dev.openjavafor...
X Description: What happens The formatter is not part of the plugin. PalantirJavaFormatProviderPlugin creates the palantirJavaFormat configuration in the root project, with a default dependency on dev.openjavafor...
Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/20
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ship the formatter jar inside the Gradle plugin instead of resolving it from the root project","articleBody":"### What happens\n\nThe formatter is not part of the plugin. `PalantirJavaFormatProviderPlugin` creates the `palantirJavaFormat` configuration in the **root project**, with a default dependency on `dev.openjavaformat:open-java-format:\u003cplugin version>`, and the native formatter gets `palantirJavaFormatNative` the same way. Both are resolved when `formatDiff` runs, from the root project's repositories.\n\nA multi-project build that declares repositories only in its subprojects therefore fails:\n\n```\n> Failed to query the value of task ':app:formatDiff' property 'nativeImage'.\n > Could not resolve all files for configuration ':palantirJavaFormatNative'.\n > Cannot resolve external dependency dev.openjavaformat:open-java-format-native:2.98.0.1\n because no repositories are defined.\n```\n\nThis was observed with plugin 2.98.0.1, Gradle 9.7.1 and `openjavaformat.native.formatter=true`. The Java-based formatter resolves `:palantirJavaFormat` in the root project in the same way.\n\n### Proposal\n\nCarry the formatter jar inside the plugin. The Java-based formatter then needs nothing from the consumer's repositories, and its version always matches the plugin's.\n\n### To decide along the way\n\n- **Version override.** The `palantirJavaFormat` configuration is also how a build pins a different formatter version. Keep it as an optional override, or drop it?\n- **IntelliJ integration.** `UpdatePalantirJavaFormatIdeaXmlFile` and `ConfigureJavaFormatterXml` write the configuration's files into `.idea/open-java-format.xml` as `implementationClassPath`. A bundled jar needs a stable file location that the IDE plugin can load, for example a copy in a cache directory, as `NativeImageAtomicCopy` already does for the native image.\n- **Class loading.** `JavaFormatExtension.serviceLoad` loads the formatter through its own `URLClassLoader`. Bundling should keep that isolation, so that the formatter's dependencies do not meet the build's classpath.\n- **Native binaries.** They are per platform and large, so bundling them is probably out of scope. That leaves `palantirJavaFormatNative` with the repository requirement, which is worth either solving separately or stating clearly in the error.\n\n### Until then\n\nThe workaround is documented at https://openjavaformat.dev/get-started/gradle/#multi-project-builds: declare `mavenCentral()` for all projects, the root included.\n\nFound together with #19, the `formatDiff` error message, while running the published plugin for the website's Get started pages.\n","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-09-21T08:01:35Z","url":"https://github.com/openjavaformat/open-java-format/issues/20"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7934b555-eaf5-0aaa-5bd9-cb084057f7da |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B45C:A306A:1318FB:1ABD3D:6AFBBB59 |
| html-safe-nonce | 9ef028cbc925e20886d7b24391007b7bfae1b24cccf02ad1e51af5e771bbeeec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDVDOkEzMDZBOjEzMThGQjoxQUJEM0Q6NkFGQkJCNTkiLCJ2aXNpdG9yX2lkIjoiNTMwMTg0Mjk3OTI4MTY4MTI0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ef8bfdeed102d371f0cf79a5ef8158275cef5d9d1b7ff8b06642deb17593c587 |
| hovercard-subject-tag | issue:5524319973 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openjavaformat/open-java-format/20/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9b248e6626220acdab147a17cc53781e4a5de41c86d4d7a25979fe569bbd4f4/openjavaformat/open-java-format/issues/20 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9b248e6626220acdab147a17cc53781e4a5de41c86d4d7a25979fe569bbd4f4/openjavaformat/open-java-format/issues/20 |
| og:image:alt | What happens The formatter is not part of the plugin. PalantirJavaFormatProviderPlugin creates the palantirJavaFormat configuration in the root project, with a default dependency on dev.openjavafor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abashev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/openjavaformat/open-java-format git https://github.com/openjavaformat/open-java-format.git |
| octolytics-dimension-user_id | 325177626 |
| octolytics-dimension-user_login | openjavaformat |
| octolytics-dimension-repository_id | 1288055459 |
| octolytics-dimension-repository_nwo | openjavaformat/open-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 214273098 |
| octolytics-dimension-repository_parent_nwo | palantir/palantir-java-format |
| octolytics-dimension-repository_network_root_id | 214273098 |
| octolytics-dimension-repository_network_root_nwo | palantir/palantir-java-format |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width