解决非可执行(common)模块jar使用maven打包时一直提示找不到main 不指定

Heck post in 编程杂谈 2018/05/02 14:05 评论(0) 阅读(6358) | |
在新建多模块maven工程,一般会新建一个parent模块,在该模块pom中会添加打包插件,
<!-- 添加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>

当然我们一般还会新建一个通用模块作为工具包之类使用,该模块pom会继承于parent。此时如果parent中pom添加的build插件,没有使用pluginManagement标签,在打包common模块时就会提示找不到main入口。

来源:Heck's Blog
地址:http://www.hecks.tk/post/470/
转载时须以链接形式注明作者和原始出处及本声明,否则将追究法律责任,谢谢配合!