[WARNING]Version "1.22.0" of Google Java Format cannot be found. Fallback to latest. | But it actually exists
Opened this issue · 1 comments
Recently I tried to set up a new GitHub Action flow using googlejavaformat-action, it works great, but I always get this particular warning in logs: [warning]Version "1.22.0" of Google Java Format cannot be found. Fallback to latest.
but I'm pretty sure it actually exists, and it also downloads the same version on the next step.
See full logs:
##[group]Run axel-op/googlejavaformat-action@v3
with:
args: --skip-reflowing-long-strings --set-exit-if-changed
version: 1.22.0
skip-commit: true
github-token: ***
files: **/*.java
env:
GIT_USER_EMAIL: actions@github.com
GIT_USER_NAME: GitHub Actions
.....
JAVA_HOME: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.11-9.1/x64
JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.11-9.1/x64
##[endgroup]
##[warning]Version "1.22.0" of Google Java Format cannot be found. Fallback to latest.
Version of JDK: 17
##[group]Downloading Google Java Format
Downloading executable to /home/runner/google-java-format.jar
[command]/opt/hostedtoolcache/Java_Corretto_jdk/17.0.11-9.1/x64/bin/java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -jar /home/runner/google-java-format.jar --version
google-java-format: Version 1.22.0
##[endgroup]
Github Action Config:
# Lint the code (fail if not successful)
- name: Linting
uses: axel-op/googlejavaformat-action@v3
with:
args: "--skip-reflowing-long-strings --set-exit-if-changed"
version: 1.22.0
skip-commit: true
github-token: ${{ secrets.GITHUB_TOKEN }}
What could cause a warning like that? How could I provide a specific version then?
After some more digging, I finally figured out what was the problem.
Apparently for some reason after version 1.14.0
the google-java-format project started to add v
prefix for all the release names in GitHub - https://github.com/google/google-java-format/releases?page=2
And that is what this plugin uses internally - check the name
field from this JSON - https://api.github.com/repos/google/google-java-format/releases
BUT in Maven they don't use v
prefix - https://mvnrepository.com/artifact/com.google.googlejavaformat/google-java-format what a surprise, huh?
So in a nutshell I need to provide a version name with v
prefix like
# Lint the code (fail if not successful)
- name: Linting
uses: axel-op/googlejavaformat-action@v3
with:
args: "--skip-reflowing-long-strings --set-exit-if-changed"
version: v1.22.0
skip-commit: true
github-token: ${{ secrets.GITHUB_TOKEN }}
Probably it will be better to add a special notion about this peculiarity in README.md, or even handle this v
prefix in the code.