美文网首页
【IDEA】搭建聚合项目抛Unable to find main

【IDEA】搭建聚合项目抛Unable to find main

作者: 长孙俊明 | 来源:发表于2019-10-15 14:52 被阅读0次

背景

项目是springboot,分多模块:common公共模块、order订单模块和stock库存模块。
项目在idea运行都没问题,一到maven install之后,common公共模块就抛出Unable to find main class。

在网络上,大部分都说在POM文件中指定mainclass。如:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>lcn-parent</artifactId>
        <groupId>com.springcloud</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>common2</artifactId>

    <!-- Unable to find main class -->
    <properties>
        <start-class>主类路径</start-class>
    </properties>
</project>

但是我在想,这个工程是定义一些常量而已,根本不需要指定mainclass,所以这个不是解决问题的根本方法。

最后查到一篇文章提到spring-boot-maven-plugin 打包跟普通的apache-maven-plugin打包不一致。
https://www.cnblogs.com/geekdc/p/10744903.html

解决方案就是,common公共模块的pom文件中的build节点去掉。

相关文章

网友评论

      本文标题:【IDEA】搭建聚合项目抛Unable to find main

      本文链接:https://www.haomeiwen.com/subject/yidsmctx.html