Comments (18)
Hello @Ivanuil, Thank you for creating this issue and we will look into it :)
from setup-java.
Haha
from setup-java.
I'm using the default installed version java 21.
there is a 17 too
https://github.com/actions/runner-images/blob/ubuntu22/20240516.1/images/ubuntu/Ubuntu2204-Readme.md#java
e.g.
# https://github.com/actions/runner-images/blob/ubuntu22/20240516.1/images/ubuntu/Ubuntu2204-Readme.md#java
- name: Switch to Java 17
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" | tee -a $GITHUB_ENV ; sudo update-java-alternatives --set $JAVA_HOME_17_X64;
Will be cool this action to take advantage of the pre-existent java versions already installed
from setup-java.
We're seeing the same thing on our self hosted runners. Shouldn't it re-use /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64
if it's already there? Or do we need to setup a tools cache like Githubs runners? This is all quite poorly documented for us running self hosted runners. Any idea @aparnajyothi-y
from setup-java.
Try specifying java-version: 17.0.11
, the action doesn't use the cache if it's not an exact version.
https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L553
from setup-java.
Try specifying
java-version: 17.0.11
, the action doesn't use the cache if it's not an exact version.
That did the trick. Thanks)
from setup-java.
Hello @Ivanuil, I've tried to reproduce the issue but didn't encounter any problems. Here's a screenshot for you to look at. Could you please outline the steps that led to this issue, so I can attempt to recreate it?
from setup-java.
@mahabaleshwars
Your screenshot says: "Java 17 was downloaded"
It should say: "Resolved Java 17.0.11 from tool-cache" when it re-uses the cache.
Look at the code I pointed to above, using "17" as the version will disqualify that dir in _work/_tool/Java_Oracle_jdk
. However, if you'd happen to have both 17
and 17.0.1
, it will pass the check that it has any caches and 17
will find its directory anyway. The logic there is quite badly implemented.
from setup-java.
Hello @Ivanuil,
If you're using the setup-java action and specify a major version like java-version: 17, the action will try to resolve it to the latest minor version. If a new minor version is released (say 17.0.12), it won't match the cache key for 17.0.11 and the JDK will be downloaded again.
To ensure that the exact version is cached and used across workflows, it's recommended to specify the exact JDK version you want to cache in your workflow file, like java-version: 17.0.11. This way, the cache key will remain consistent across workflow runs.
from setup-java.
Hello @Ivanuil Yeah but that's not how it works in reality, unfortunately. See my comments above.
from setup-java.
something is downloading every time that i build something
jobs:
build_android:
if: "contains(github.event.head_commit.message, 'build-android')"
name: Build Android
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.19.1"
- name: Setup Java
uses: actions/[email protected]
with:
java-version: 17.0.11
distribution: "oracle"
check-latest: false
cache: "gradle"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
from setup-java.
something is downloading every time that i build something
jobs: build_android: if: "contains(github.event.head_commit.message, 'build-android')" name: Build Android runs-on: self-hosted steps: - name: Check out repository code uses: actions/checkout@v4 - name: use Node.js uses: actions/setup-node@v4 with: node-version: "18.19.1" - name: Setup Java uses: actions/[email protected] with: java-version: 17.0.11 distribution: "oracle" check-latest: false cache: "gradle" - name: Setup Android SDK uses: android-actions/setup-android@v3
Same for me :( Everything worked as it was supposed to for a month. And a few days ago the action started redownloading something on every run. It also usually fails to download (percentage get stuck at some point) and i have to cancel that run
from setup-java.
My job looks like this:
- name: set up JDK 17
uses: actions/[email protected]
with:
distribution: 'oracle'
java-version: 17.0.11
check-latest: false
cache: 'maven'
from setup-java.
Hi @Ivanuil, I've attempted to reproduce the issue but I didn't encounter the problem you described. Could you provide a public repository where the issue is reproducible?
from setup-java.
Hi @Ivanuil, I've attempted to reproduce the issue but I didn't encounter the problem you described. Could you provide a public repository where the issue is reproducible?
Sure, repo: https://github.com/Ivanuil/FriendAlertBot
action: https://github.com/Ivanuil/FriendAlertBot/actions/runs/9856712473
from setup-java.
Related Issues (20)
- Cache is reported as found and restored, but artifacts are still being downloaded HOT 4
- Can't install temurin java 8 for macos HOT 6
- java.lang.IllegalAccessError: superclass access check failed with `setup-java@v4` HOT 4
- `setup-java@v4` setup for sbt failing on macOS with `line 1: sbt: command not found` HOT 9
- Azul distribution support HOT 4
- GPG-Signing of maven artifacts fails on Windows runners with `actions/setup-java@v4` and `maven-gpg-plugin` `v3.2.4` HOT 6
- setup java: Would be nice if there was an option to set the locale via ability to pass system properties to jdk launched
- Support env setting of AGENT_TOOLSDIRECTORY as in the setup-python action HOT 1
- Gradle caching post-task consistently fails on Windows with "device or resource busy" HOT 6
- Allow differentiating Zulu releases with/without CRaC HOT 1
- Ignore certificate HOT 1
- Unable to parse Java version on Ubuntu runner HOT 3
- Dragonwell version number parsing failed HOT 2
- `temurin` Distribution unavailable for `windows-latest` and `macos-latest` on JDK 8 HOT 2
- action sometimes throws "Could not load manifest for Microsoft Build of OpenJDK" HOT 5
- Specify distribution via java-version-file HOT 1
- Recién HOT 1
- Bug in set-up java 17
- CRAC JDK is not usable as criu needs SUID permissions to work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setup-java.