Running a spring boot application with maven

On the last 2 part tutorial that I published recently on Spring boot :Spring boot and spring data (part 1) and Spring boot and spring data (part 2) I said that when using pure maven (not the groovy approach) you needed to either package the project and then run the JAR manually or use the maven mojo exec plugin (which I preferred)

But as often after playing a bit more with it I realized that there is an even simpler solution and that is using the run goal of the spring-boot maven plugin

So you can simply run your spring-boot project by executing the following goal on your console/IDE


 mvn spring-boot:run

2 comments:

  1. Hi, I'm doing this and all I got is NoSuchBeanDefinitionException from Spring :(

    I'm currently running maven with submodules, so my command looks like this:

    mvn spring-boot:run -pl my-submodule

    I already know that everything with my code is ok and the Spring Context is there when I run the application normally as jar (without maven). What can I be doing wrong? :/

    Is there something to consider when you run the project with submodules?

    ReplyDelete
    Replies
    1. Hi, I'm not 100% sure since I haven't run a spring-boot project using maven submodules, but perhaps your issue can come from the fact that a spring-boot project needs to inherit from the "spring-boot-starter-parent" and for some reason the submodule is not seeing this... which of your POMs has the starter module as a parent?
      Is your code accessible somewhere I could take a look? or at least the POM files?

      Delete

OSX show used ports or listening applications with their PID

On OSX you can display applications listening on a given port using the lsof the commands described below will show listening application...