zoukankan      html  css  js  c++  java
  • 记一次mvn clean install 报package com.rockysaas.shopguide.common.config.threadpool does not exist

    最近在导购项目中增加了两个模块,common,job. 原先的admin,web还有job引用了common包。其中common包的pom.xml如下

    <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>com.rockysaas.shopguide</groupId>
            <artifactId>shopguide-parent</artifactId>
            <version>1.0.0</version>
        </parent>
        <groupId>com.rockysaas.shopguide</groupId>
        <artifactId>common</artifactId>
        <version>1.0.0</version>
        <name>common</name>
        <packaging>jar</packaging>
    
        <description>Common project for ShopGuide</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.8</version>
            </dependency>
    
            <dependency>
                <groupId>cn.hutool</groupId>
                <artifactId>hutool-all</artifactId>
                <version>4.5.1</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>

    admin的pom.xml引用到了common包

      <dependencies>
     。。。
            <dependency>
                <groupId>com.rockysaas.shopguide</groupId>
                <artifactId>common</artifactId>
            </dependency>
    。。。
    </dependencies>

    admin项目引用了common里的变量

    import com.rockysaas.shopguide.common.config.threadpool.ThreadPoolProperties;
    @Component
    @ConfigurationProperties(prefix = "task.threadpool.executor")
    public class TaskThreadPoolProperties extends ThreadPoolProperties {
    }

    但是整个项目mvn clean install -Dmaven.test.skip=true 时却报了

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project admin: Compilation failure: Compilation failure:

    在idea中启动项目没问题也没报编译错误,而且我在job项目里引入common的变量后也有这个问题。经过几个小时的实验和测试,发现问题是在common的pom.xml里加上了

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

    把这个去掉就一切正常。这个插件是启动springboot项目服务时用的,但common只是一个包,并不需要启动服务。看来对一些东西不是特别清楚时乱加就是会出各种问题。

    喜欢艺术的码农
  • 相关阅读:
    Mac idea 打不开
    git学习之git reset命令
    更改 macOS 用户帐户和个人文件夹的名称
    SpringBoot系列: 如何优雅停止服务
    windows环境下启动mongodb服务
    rocketMq4.2.0启动broker报错找不到或无法加载主类 FilesJavajdk1.8.0_101libdt.jar;C:Program]
    初创公司与成熟的公司各有什么利弊?有5年工作经验的人适合进那一个?(行业职位是一样的情况下)
    mac 10.15 国内如何安装brew
    Mac下SSH Key配置
    买苹果MacBook Pro ,有必要买care吗?
  • 原文地址:https://www.cnblogs.com/zjhgx/p/12460707.html
Copyright © 2011-2022 走看看