1

I'm learning about Spring Boot multi module projects and I try to understand what exactly does spring boot maven plugin.

For example I have 2 different projects. In the first project I have the spring boot maven plugin in the web module:

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <version>2.0.4.RELEASE</version>
      <configuration>
        <mainClass>dgs.web.DemoApplication</mainClass>
        <layout>ZIP</layout>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>repackage</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

And in the second project I have this plugin in the data module:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         <executions>
             <execution>
                 <goals>
                     <goal>repackage</goal>
                 </goals>
                 <configuration>
                     <skip>true</skip>
                 </configuration>
             </execution>
         </executions>
        </plugin>
    </plugins>
</build>

And this is in the parent pom of the 2nd project:

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

Can somebody explain me what exaclty does this spring boot maven plugin especially in the second project? And why there is no reference about mainClass. I see this mainClass tag only in the first project.

1
  • For exact code examples, one should give also parent decralation, as usually Spring Boot parent is used, that defines a lot of defaults for spring-boot-maven-plugin. Again see docs given. Commented Mar 24, 2021 at 2:38

1 Answer 1

0

The maven plugin is for packaging and executing via Maven.

You should read the docs:

https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html

https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/maven-plugin/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.