palantir / palantir/palantir-java-format

Create release with all dependencies

Open
#322 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
907
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

Hi, currently some of the dependencies are missing in palantir-java-format.jar. A few months ago it was working without any problem because palantir's java-format had the same dependencies as google-java-format and users who use palantir-java-format as cli used to run it with the following classpath:

/usr/bin/java  \
    -cp /usr/share/java/palantir-java-format/palantir-java-format.jar:/usr/share/java/palantir-java-format/palantir-java-format-spi.jar:/usr/share/java/google-java-format/google-java-format-all-deps.jar \
    com.palantir.javaformat.java.Main "${@}"

As you can see, we just used the dependencies provided by google-java-format-all-deps.jar.

But now palantir-java-format has some dependencies that are not packed into jar, for example, org.openjdk.* and it's actually quite impossible to use palantir-java-format as cli right now. The solution would be to pack all dependencies into a jar (either into palantir-java-format.jar or a separated one — palantir-java-format-all-deps.jar like google does).

For example this patch can be applied (I can send PR if it's a viable solution):

diff --git a/gradle/publish-jar.gradle b/gradle/publish-jar.gradle
index 1e017db..d9f99e4 100644
--- a/gradle/publish-jar.gradle
+++ b/gradle/publish-jar.gradle
@@ -17,6 +17,10 @@ jar {
     manifest {
         attributes("Implementation-Version" : project.version)
     }
+
+  from {
+    configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+  }
 }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with gradle/publish-jar.gradle and inspect how the jar task assembles runtimeClasspath. Build the release artifact and verify that the dependencies needed by the CLI, including org.openjdk.* classes, are packaged in the main jar or a separate all-dependencies jar.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.