Skip to content

Conversation

@Lublanski
Copy link
Contributor

@Lublanski Lublanski commented Oct 18, 2025

Fixes #46866

Summary
This PR updates the spring-boot Homebrew formula to install JARs under libexec instead of lib.
This change follows Homebrew best practices to avoid conflicts between packages when HOMEBREW_DEVELOPER=true is enabled.

Changes

  • Updated the formula to install all JARs into libexec.
  • Wrapped the spring binary with write_env_script to ensure correct runtime paths.
  • Verified shell completion installation for Bash and Zsh.

Verification
Tested locally with:
HOMEBREW_DEVELOPER=true brew install --build-from-source spring-boot

Result: No warnings when running with HOMEBREW_DEVELOPER=true, and the CLI works as expected.

Before change
Captura de tela de 2025-10-18 20-01-45

After change
Captura de tela de 2025-10-18 19-59-41

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 18, 2025
Signed-off-by: Vinicius Lublanski <vlublima@gmail.com>
Signed-off-by: Vinicius Lublanski <vlublima@gmail.com>
@Lublanski Lublanski force-pushed the fix/spring-boot-homebrew-libexec branch from 2bdcaba to 5be051c Compare October 18, 2025 22:47
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 20, 2025
@snicoll snicoll added this to the 3.4.11 milestone Oct 20, 2025
@snicoll snicoll self-assigned this Oct 20, 2025
@snicoll
Copy link
Member

snicoll commented Oct 20, 2025

Please don't paste screenshots, they aren't very helpful. What did you do locally for the command to succeed? It can't work as version and hash aren't provided. I want to make sure I am running the same as you.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Oct 20, 2025
@snicoll snicoll changed the title Fix/spring boot homebrew libexec Homebrew formulat for the CLI should use libexec Oct 20, 2025
@snicoll snicoll changed the title Homebrew formulat for the CLI should use libexec Homebrew formula for the CLI should use libexec Oct 20, 2025
@Lublanski
Copy link
Contributor Author

Lublanski commented Oct 20, 2025

Please don't paste screenshots, they aren't very helpful. What did you do locally for the command to succeed? It can't work as version and hash aren't provided. I want to make sure I am running the same as you.

@snicoll
Sorry for screenshots.
In the fix branch, i used:

class SpringBoot < Formula
  homepage 'https://spring.io/projects/spring-boot'
  url 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-cli/3.5.6/spring-boot-cli-3.5.6-bin.tar.gz'
  version '3.5.6'
  sha256 '3ac9314100c474ddad1c4ae04a85404383817d6f748820980e26ccbe55393bbe'
  head 'https://github.com/spring-projects/spring-boot.git', :branch => "main"

And running the command HOMEBREW_DEVELOPER=true brew install --build-from-source spring-boot

what values ​​for $repo, $version and $hash did you use to make it not work?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 20, 2025
@snicoll
Copy link
Member

snicoll commented Oct 20, 2025

what values ​​for $repo, $version and $hash did you use to make it not work?

I didn't do anything. I wanted to know what you did. With the value above, this is what I get

HOMEBREW_DEVELOPER=true brew install --build-from-source ./spring-boot.rb
Error: Failed to load cask: ./spring-boot.rb
Cask 'spring-boot' is unreadable: wrong constant name #<Class:0x000000013ced28c0>
Warning: Treating ./spring-boot.rb as a formula.
==> Fetching downloads for: spring-boot
✔︎ Formula spring-boot (3.5.6)
🍺  /opt/homebrew/Cellar/spring-boot/3.5.6: 12 files, 8.0MB, built in 1 second
==> Running `brew cleanup spring-boot`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
brew --version
Homebrew 4.6.17-67-g00001be

I have no idea what wrong constant name #<Class:0x000000013ced28c0> is and that's why I wanted the instruction to reproduce what works for you.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Oct 20, 2025
@Lublanski
Copy link
Contributor Author

what values ​​for $repo, $version and $hash did you use to make it not work?

I didn't do anything. I wanted to know what you did. With the value above, this is what I get

HOMEBREW_DEVELOPER=true brew install --build-from-source ./spring-boot.rb
Error: Failed to load cask: ./spring-boot.rb
Cask 'spring-boot' is unreadable: wrong constant name #<Class:0x000000013ced28c0>
Warning: Treating ./spring-boot.rb as a formula.
==> Fetching downloads for: spring-boot
✔︎ Formula spring-boot (3.5.6)
🍺  /opt/homebrew/Cellar/spring-boot/3.5.6: 12 files, 8.0MB, built in 1 second
==> Running `brew cleanup spring-boot`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
brew --version
Homebrew 4.6.17-67-g00001be

I have no idea what wrong constant name #<Class:0x000000013ced28c0> is and that's why I wanted the instruction to reproduce what works for you.

@snicoll
Thanks for testing this!

Are you using macOS?
The error message:

Error: Failed to load cask: ./spring-boot.rb  
Cask 'spring-boot' is unreadable: wrong constant name #<Class:...>  

can happens on macOS because Homebrew first tries to interpret any local .rb file as a Cask (used for GUI apps).

On Linux this doesn’t happen, so the formula installs fine.

To fix this on macOS, please run the command with the --formula flag so Homebrew treats it correctly:
HOMEBREW_DEVELOPER=true brew install --formula --build-from-source ./spring-boot.rb

That will force Homebrew to use the Formula loader instead of the Cask loader and should work as expected.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 20, 2025
@snicoll
Copy link
Member

snicoll commented Oct 20, 2025

Are you using macOS?

Yes. Thanks for the hint! I am on the same page as you now.

snicoll pushed a commit that referenced this pull request Oct 21, 2025
See gh-47696

Signed-off-by: Vinicius Lublanski <vlublima@gmail.com>
snicoll added a commit that referenced this pull request Oct 21, 2025
@snicoll snicoll closed this in b9ce639 Oct 21, 2025
@Lublanski
Copy link
Contributor Author

Lublanski commented Oct 21, 2025

@snicoll
Thank you for accepting the adjustment. I'm glad I was able to contribute. I'll look for new, simple issues to try to contribute more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: feedback-provided Feedback has been provided type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix brew warnings for Spring Boot CLI

3 participants