Add minimal example project for Gradle Java libraries#3155
Add minimal example project for Gradle Java libraries#3155
Conversation
Signed-off-by: s-stumbo <sally.stumbo@chainguard.dev>
✅ Deploy Preview for ornate-narwhal-088216 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| ```bash | ||
| ./gradlew app:assemble | ||
| find ~/.gradle/caches/modules-2/files-2.1/com.google.guava -name "*.jar" | sort |
There was a problem hiding this comment.
What is that supposed to do? Also .. add chainctl libraries verify ?
There was a problem hiding this comment.
I had trouble with this one trying to find the file. I just updated this part to separate the build command and then explain what I'm doing with find in the second command. If there's a better way, we can change this
Signed-off-by: s-stumbo <sally.stumbo@chainguard.dev>
mosabua
left a comment
There was a problem hiding this comment.
Seems good overall. Somebody should test this to confirm. I wont be able to get around to that
| } | ||
| } | ||
| ``` | ||
| >Note: Do not store credentials directly in build files; use environment |
There was a problem hiding this comment.
Not sure if this renders correctly without space between > and Note:
There was a problem hiding this comment.
FWIW, this does render correctly in the preview but for precision's sake I'd just add a space.
Also, I prefer to bold the "Note:" so it pops a bit
| } | ||
| } | ||
| ``` | ||
| >Note: Do not store credentials directly in build files; use environment |
There was a problem hiding this comment.
FWIW, this does render correctly in the preview but for precision's sake I'd just add a space.
Also, I prefer to bold the "Note:" so it pops a bit
| users home directory. Use the following command to delete it: | ||
| Java you must delete that local cache so that libraries | ||
| are downloaded again. By default the cache is located in a hidden | ||
| `~/.gradle/caches` directory in your users home directory. |
There was a problem hiding this comment.
| `~/.gradle/caches` directory in your users home directory. | |
| `~/.gradle/caches` directory in your user's home directory. |
| repository group or virtual repository from your repository manager | ||
| `https://repo.example.com/group/` and any applicable authentication details. | ||
|
|
||
| Open `app/build.gradle` and update the `repositories` block to include the following repository. Ensure it is located above the `mavenCentral` repository and any |
There was a problem hiding this comment.
ngl, i don't believe in an 80 char limit for docs because i find it hard to maintain consistently, and here's an example of why. You have one very long line followed by a short one
| Use the following steps to create a minimal example project for Gradle with Chainguard Libraries for Java. For testing purposes, you can use direct access and environment variables as | ||
| detailed in the [access documentation](/chainguard/libraries/access/#use-environment-variables-for-pull-token-credentials). | ||
|
|
||
| **Step 1: Clear the cache** |
There was a problem hiding this comment.
I'm not crazy about having two 'Step 1s' under the same H2. Like, if this is it's own set of steps it should be a separate doc or something
|
|
||
| **Step 2: Create the example project** | ||
|
|
||
| Run the following command: |
There was a problem hiding this comment.
| Run the following command: | |
| First, create a project directory and navigate into it: |
| Run the following command: | ||
|
|
||
| ```bash | ||
| mkdir gradle-example |
There was a problem hiding this comment.
| mkdir gradle-example | |
| mkdir gradle-example && cd $_ | |
| ``` |
|
|
||
| ```bash | ||
| mkdir gradle-example | ||
| cd gradle-example |
There was a problem hiding this comment.
| cd gradle-example | |
| Next, initialize an example project: | |
| ``` | |
| cd gradle-example |
not sure the instruction is right, but def add some more context here
|
|
||
| Edit the `repositories` block in `app/build.gradle` to point to Chainguard and use the environment variables for your pull token credentials: | ||
|
|
||
| ```groovy |
There was a problem hiding this comment.
I think since we're editing a file that we know exists we should give more indication that that's what we're doing. Like, I would give the command to open the file for editing (nano app/build.gradle) and label the code block with the file name:
| ```groovy | |
| ```app/build.gradle |
| version catalog in `gradle/libs.versions.toml`, so guava is downloaded from | ||
| Chainguard Libraries as part of the build. | ||
|
|
||
| Following the build, find the guava jar declared in the version catalog at: |
There was a problem hiding this comment.
We don't uses this guava jar, right? if not I think we should just say "you can" since it isn't necessary to continue:
| Following the build, find the guava jar declared in the version catalog at: | |
| Following the build, you can find the guava jar declared in the version catalog at `~/.gradle/caches/modules-2/files-2.1/com.google.guava`. |
| ```bash | ||
| ~/.gradle/caches/modules-2/files-2.1/com.google.guava | ||
| ``` |
There was a problem hiding this comment.
| ```bash | |
| ~/.gradle/caches/modules-2/files-2.1/com.google.guava | |
| ``` |
This isn't a command, so it definitely shouldn't have a bash/shell label on the code block. Unless I'm misunderstanding, it seems clearer to just leave it in the paragraph above.
[ ] Check if this is a typo or other quick fix and ignore the rest :)
Type of change
Adding minimal example project for Java libraries with Gradle
What should this PR do?
Why are we making this change?
For consistency across libraries docs, we're adding minimal example projects
What are the acceptance criteria?
Content should be clear and accurate
How should this PR be tested?
Follow the steps to create the example