Skip to content

[WARNING]Version "1.22.0" of Google Java Format cannot be found. Fallback to latest. | But it actually exists #32

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

Closed
BeshEater opened this issue May 20, 2024 · 2 comments

Comments

@BeshEater
Copy link

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?

@BeshEater
Copy link
Author

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.

@axel-op
Copy link
Owner

axel-op commented Feb 17, 2025

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

Yes, you're right. I don't want to add too many magic features in the code which would make it (in my opinion) even more confusing, so I'll just pin this issue and close it as a "won't fix".

@axel-op axel-op closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2025
@axel-op axel-op pinned this issue Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants