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.

 

Advertisements

About stevewall123

I am a Lead Software Engineer in Minneapolis working for Thomson Reuters. I am currently working on projects using Java, JavaScript, Spring, Drools, Hazelcast, Liquibase and Tomcat. Previously, I used C#, GWT, Grails, Groovy, JMS and JBoss Drools Guvnor. In the past I have worked on projects using J2EE, Swing, Webwork, Hibernate, Spring, Spring-WS, JMS, JUnit and Ant.
This entry was posted in Eclipse, Maven, Spring, Spring Boot, Tomcat and tagged , , , , . Bookmark the permalink.

3 Responses to Spring Boot Web Application – Starting in Eclipse

  1. Benito says:

    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!

    • stevewall123 says:

      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. David O'Brien says:

    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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s