spring-guides / gs-spring-boot

Building an Application with Spring Boot :: Learn how to build an application with minimal configuration.
https://spring.io/guides/gs/spring-boot/
Apache License 2.0
890 stars 4.51k forks source link

Gemfile error when running app.groovy with Spring Boot CLI #17

Closed kentoj closed 10 years ago

kentoj commented 10 years ago

In the "JAR support and Groovy support" section after installing the Spring Boot CLI with Homebrew on Mac OS X Mavericks I get a "no Gemfile present" error when running app.groovy with the "spring run app.groovy" command.

The error I get is:

groovy(master) > spring run app.groovy /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:46:in find_project_root': Spring was unable to locate the root of your project. There was no Gemfile present in the current directory (/Users/kent/git/public/spring-projects/koj-gs-spring-boot/src/main/groovy) or any of the parent directories. (Spring::UnknownProject) from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:infind_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:in find_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:infind_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:in find_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:infind_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:in find_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:infind_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:in find_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:48:infind_project_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/configuration.rb:37:in project_root_path' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/env.rb:27:inproject_root' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/env.rb:41:in application_id' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/env.rb:53:inpidfile_path' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/env.rb:68:in server_running?' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:24:incall' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in call' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client.rb:26:inrun' from /Users/kent/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.1.3/bin/spring:48:in <top (required)>' from /Users/kent/.rbenv/versions/2.1.2/bin/spring:23:inload' from /Users/kent/.rbenv/versions/2.1.2/bin/spring:23:in `

'

dsyer commented 10 years ago

I do t think that's the Spring Boot CLI. Looks like you have a "spring" executable from a ruby gem in your PATH.

gregturn commented 10 years ago

Spring boot is Java and shell not Ruby.

kentoj commented 10 years ago

ok, thanks for the heads up dsyer. Do you know how I would access the spring CLI without uninstalling ruby?

dsyer commented 10 years ago

Find out where the CLI is installed and call it SPRING_HOME, then

$ export PATH=$SPRING_HOME/bin/:$PATH

You don't have to uninstall ruby to get rid of that gem though. Just "gem uninstall spring". Or switch to a clean ruby environment using rbenv (which I can see you are using).

kentoj commented 10 years ago

Thanks for the help @dsyer! Everything is working fine now.

kalmanh commented 9 years ago

spring is a gem used by Ruby on Rails framework as of version 4.1 (http://guides.rubyonrails.org/4_1_release_notes.html) and it just happens to also use an executable called 'spring'. It's pretty funny how the first commit to this spring gem is about 2 months after the first commit to spring-boot project

https://github.com/rails/spring/commit/a035f47a4f1c930cbc452eb87aeabaab409a0e64

Unfortunate coincidence? :8ball:

dsyer commented 9 years ago

Coincidence indeed. I guess Rails users have to alias "spring" to "springboot" or something.

mhewedy commented 8 years ago

As mentioned by @dsyer , here's steps to execute on your shell (on mac)

gem uninstall spring
cd /usr/local/bin
sudo ln -sf ../Cellar/springboot/*.RELEASE/bin/spring . 
dsmithco commented 7 years ago

Don't need to uninstall anything...

cd /usr/local/bin
sudo ln -sf ../Cellar/springboot/*.RELEASE/bin/spring ./springboot

Then just call springboot init or whatever

ekyfauzi commented 7 years ago

Thanks @dsmithco !

TheChronicMonster commented 6 years ago

@dsmithco Worked for me. Thank you.