actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java
MIT License
1.52k stars 731 forks source link

maven cache is not found #577

Closed hajjoujti closed 2 months ago

hajjoujti commented 8 months ago

Description: I am having an issue on my workflows because they are saving the cache at the Post Set Up Java but the cache is not found in the next time this workflow is being triggered. I have three workflows and all three are behaving the same.

Set Up Java:

Run actions/setup-java@v4.0.0
Installed distributions
Creating settings.xml with server-id: ossrh
Writing to /home/runner/.m2/settings.xml
Importing private gpg key
maven cache is not found

Post Set Up Java:

Post job cleanup.
Removing private key from keychain
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/jumble-juggler/jumble-juggler --files-from manifest.txt --use-compress-program zstdmt
Cache Size: ~21 MB (22524066 B)
Cache saved successfully
Cache saved with the key: setup-java-Linux-maven-2ce1e5c635a93fe6e2777be9e471759542e7a1e7c394f7baf484fee1a0985f95

Task version: Specify the task version

Platform:

Runner type:

Repro steps: It is a public repository: https://github.com/jumble-juggler/jumble-juggler The three YAML file are in .github/workflows

Expected behavior: Should use the cache maven.

Actual behavior: maven cache is not found and it is saving the cache every time which takes a lot of time.

IvanZosimov commented 8 months ago

Hi, @hajjoujti 👋 Thanks for the bug report, we will take a look!

antonmos commented 8 months ago

same problem when using cache: 'gradle' option

bakoontz2 commented 3 months ago

Same here, cache is being created in post-action step but not being found in next run...

Be sure you aren't modifying the pom.xml file prior to running setup-java. If you are, then it's likely you'll always get a cache miss.

priya-kinthali commented 2 months ago

Hello @hajjoujti 👋, Thank you for your report. I couldn't replicate the cache issue you mentioned and the caching mechanism working as intended. To help resolve the issue, I suggest considering the following aspects:

Additionally, there have been similar reports about the maven cache not being used when workflows have different targets. Please see if this issue is relevant to your situation. If you're having issues with the gradle cache, please refer to this issue and see if the discussion there is relevant to your case. I hope this information is helpful.

priya-kinthali commented 2 months ago

Hello @hajjoujti, Just checking in to see if you had a chance to review the suggestions provided earlier regarding the cache issue in your workflows. Please let us know if the information was helpful or if you need further assistance. Thank you!

hajjoujti commented 2 months ago

Hello, Sadly I didn't have the time to check it out and it's been a while I didn't work on this project. I'm not sure when I will have the time to check it out. I think it is safe to close this issue and I will recomment here if when I check it out again.

priya-kinthali commented 2 months ago

Hello @hajjoujti 👋, Thank you for the update. I'll go ahead and close this issue for now. Please feel free to reopen it or comment here if you have any updates or encounter the problem again. Thank you for your understanding and cooperation:)