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只是一个包,并不需要启动服务。看来对一些东西不是特别清楚时乱加就是会出各种问题。

    喜欢艺术的码农
  • 相关阅读:
    [ ERROR ] Error in test library 'pymysql': Creating keyword 'Connect' failed: Keyword with same name defined multiple times.
    【robotframework】pycharm+robotframe(转)
    Django 配置mysql遇到问题(一)
    Django 初始化数据库遇到问题(python manage.py migrate)
    连接mysql报"ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server"
    性能测试-MySQL性能查看(转)
    APP安全测试
    在线java堆栈分析工具
    性能-如何根据线程和进程找到性能瓶颈或者问题点
    Jmeter CSV参数带汉字处理
  • 原文地址:https://www.cnblogs.com/zjhgx/p/12460707.html
Copyright © 2011-2022 走看看