0

I'm learning about Maven and I want to ask you why do I need to add the Spring Boot Maven plugin in the pom.xml if I want to run it?

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

But I don't need to add the install, deploy, compiler, clean and all other plugins. How does this plugins come in my project?

So I need to add this code in the pom.xml if I want to use this command: mvn spring-boot:run, but I don't need to add any code for these commands: mvn install:install, mvn compiler:compile, etc. I don't understand how. Thank you!

elvis
  • 956
  • 9
  • 33
  • 56

1 Answers1

1

Compile, install, test, etc is part of the default maven lifecycle, specified in default-bindings.xml in your maven installation. This lifecycle configuration connects lifecycle stages (for instance compile) with plugins (maven-compiler-plugin), and is inherited by all your maven projects.

The spring-boot-maven-plugin on the other hand is not part of the any default lifecycle, and thus needs to be specified in each project.

Tobb
  • 11,850
  • 6
  • 52
  • 77