-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding documentation about creation of uber-JARs #3785
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Pranav Garg <pranavgarg@gmail.com>
Signed-off-by: Pranav Garg <pranavgarg@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where it's going.
DEVELOPER_GUIDE.md
Outdated
Add the shadow plugin: | ||
``` | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then what? What do I type now to generate the fat JAR and what does it produce? Feel free to include console output, just walk me through it like a 2yo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I had previously added the following steps but somehow they did not make it to the commit. updating the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the console output:
(base) garprana@88665a37c3c3 rest-high-level % ../../gradlew shadowJar
> Configure project :qa:os
Cannot add task 'destructiveDistroTest.docker' as a task with that name already exists.
=======================================
OpenSearch Build Hamster says Hello!
Gradle Version : 6.6.1
OS Info : Mac OS X 12.4 (x86_64)
JDK Version : 11 (JDK)
JAVA_HOME : /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
Random Testing Seed : D0C50CCED424B21E
In FIPS 140 mode : false
=======================================
BUILD SUCCESSFUL in 9s
36 actionable tasks: 1 executed, 35 up-to-date
Which is not providing a lot of information so have not included it in the document.
DEVELOPER_GUIDE.md
Outdated
# Creating uber-JAR/fat-JAR of a module | ||
An uber-JAR is the JAR, which contains classes from all the libraries, on which your project depends and, of course, the classes of current project. | ||
|
||
There might be cases where the developer would like to add some custom logic to the code of a module (like the rest client) and generate anuber-JAR that can be directly used by the dependency management tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, in #3702 a developer needed ...
Signed-off-by: Pranav Garg <pranavgarg@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close! I think I want some more about how to use this and an example.
apply plugin: 'com.github.johnrengelman.shadow' | ||
``` | ||
After applying the plugin you should see a new gradle command `shadowJar`. Run the command using: | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to say "After applying ..." it's the next step.
The suggestion is a bit hacky since it implies changing directories. All instructions are usually from root. Let's say
./gradlew :client:rest-high-level:shadowJar
DEVELOPER_GUIDE.md
Outdated
``` | ||
Note: `gradlew` is at the root of OpenSearch project directory. You will have to change the path according to the module you are trying to build the shadowJar for. | ||
|
||
This will generate a fat-JAR in the `build/distributions` folder of the module. The default name of the fat-JAR will be `opensearch-[MODULE NAME]-[VERSION].jar`. You can inspect that it contains all the requirements using a decompiler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will generate a fat-JAR in the build/distributions
folder of the module, e.g. ./client/rest-high-level/build/distributions/opensearch-rest-high-level-client-1.4.0-SNAPSHOT.jar
.
I think you can remove "the default name..." and the "you can inspect" part because it doesn't really give you much useful info. The example is more helpful.
DEVELOPER_GUIDE.md
Outdated
|
||
This will generate a fat-JAR in the `build/distributions` folder of the module. The default name of the fat-JAR will be `opensearch-[MODULE NAME]-[VERSION].jar`. You can inspect that it contains all the requirements using a decompiler. | ||
|
||
You can further customize your fat-JAR by customising the plugin, details for this can be found in the Shadow plugin [documentation](https://imperceptiblethoughts.com/shadow/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More information about shadow plugin can be found here.
Signed-off-by: Pranav Garg <pranavgarg@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some more nitpicks, the only must have is the capitalization of the section title. Also what's up with CI/CD? :(
Signed-off-by: Pranav Garg <pranavgarg@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
The jenkins link mentions that there were no ownership configured for the test run, Can that be the issue? All the tests are skipped in the run. |
Why are PRs getting merged before passing gradle check? |
It was a markdown only change (docs). I didn't want the doc to be incorrect regardless of the status of our build. |
Signed-off-by: Pranav Garg pranavgarg@gmail.com
Description
Adding documentation about creation of uber-JARs
Issues Resolved
#3702
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.