Banging My Head Against the Wall

What I wish I knew before I started…

Spring Boot Web Application – Starting in Eclipse


I am going through the Spring Boot Getting Started Tutorial and trying to follow the steps in Eclipse (and not STS).  I made it to the end and was thrown off a little by how to “start” it up.

I wanted to create a Tomcat Server within Eclipse for the project and start.  However the tutorial does not mention that step, instead saying to run the Maven command:

mvn spring-boot:run

I was initially confused as I was wanting to start my Tomcat server within Eclipse, perhaps with some additional start up parameters.  NO!

Instead do the following steps:

  1. In your Project Explorer view, right click and select Run As -> Maven build…
  2. On the Edit Configurations dialog, in the “Goals” field enter:  mvn spring-boot:run
  3. Finally, click Run

That Maven goal will actually start up an embedded Tomcat server (behind the scenes).  It will not use any Tomcat server you have have created in the Eclipse Servers view.

In the end, the tutorial steps are correct, it was just me not following the steps.

 


4 responses to “Spring Boot Web Application – Starting in Eclipse”

  1. Hi Steve,

    I did like you say but i get this error in eclipse:

    Unknown lifecycle phase “mvn”. You must specify a valid lifecycle phase or a goal in the format….

    I am using the maven installed on my OS and not the eclipse plugin. Could this be the problem???

    Regards!

    • Not sure about that. One idea: On your Maven run configuration, do you have “mvn” listed as one of the goals. You just need to specify the goals (e.g. “clean install”) and not the “mvn”. Try searching Stack Overflow or Google with your error message.

  2. On the Edit Configurations dialog, in the “Goals” field enter: spring-boot:run
    instead of
    On the Edit Configurations dialog, in the “Goals” field enter: mvn spring-boot:run

Leave a comment