Solve the problem that the main module cannot be found when the non-executable (common) module jar is packaged with maven

When creating a new multi-module maven project, a parent module is generally created, and a packaging plug-in is added to the pom of this module.
<!-- 添加spring-boot的maven插件 -->
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <target>${java.version}</target>
                    <source>${java.version}</source>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Of course, we usually create a new general module as a toolkit and the like, and the module pom will inherit from parent. At this time, if the build plugin added to the pom in the parent does not use the pluginManagement tag, it will prompt that the main entry cannot be found when the common module is packaged.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326488208&siteId=291194637