gpt4 book ai didi

java - Maven 多模块清理和构建失败

转载 作者:行者123 更新时间:2023-12-01 19:16:26 25 4
gpt4 key购买 nike

我在清理和构建项目时收到以下警告

     Some problems were encountered while building the effective model for
com.salesforce:Main:jar:0.0.1-SNAPSHOT 'dependencyManagement.dependencies.dependency.
exclusions.exclusion.artifactId'
for org.quartz-scheduler:quartz:jar with value '*' does not match a valid id
pattern. @ org.springframework.boot:spring-boot-dependencies:2.2.0.RELEASE,
C:\Users\HP\.m2\repository\org\springframework\boot\spring-boot-
dependencies\2.2.0.RELEASE\spring-boot-dependencies-2.2.0.RELEASE.pom, line
2753, column 25

强烈建议修复这些问题,因为它们会威胁到您构建的稳定性。

因此, future 的 Maven 版本可能不再支持构建此类格式错误的项目。

我的父 Pom.xml 如下:-

<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>Models</module>
<module>Utilities</module>
<module>Services</module>
<module>WebControllers</module>
<module>Main</module>
</modules>

<groupId>com.salesforce</groupId>
<artifactId>rstkapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>rstkm-api</name>
<description>Salesforce REST API</description>

<properties>
<java.version>1.8</java.version>
<spring.version>2.2.0.RELEASE</spring.version>
</properties>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>


<dependencyManagement>
<dependencies>
<dependency>
<artifactId>Models</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<artifactId>Utilities</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<artifactId>Services</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<artifactId>WebControllers</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<artifactId>Main</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.version}</version>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.version}</version>
</dependency>

<!--Dependencies for Apache Kafka-->

<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>


<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>


<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>


<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.54</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.54</version>
</dependency>


<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<type>jar</type>
<scope>compile</scope>
<version>3.1.0</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
<version>42.2.9.jre7</version>
</dependency>

<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>9.0.29</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.6.1.SP2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>


<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>${spring.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>


</plugins>

</build>

我的主模块 pom.xml 如下:-

<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>Main</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<java.version>1.8</java.version>
</properties>

<parent>
<artifactId>rstkapp</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>


<dependencies>

<dependency>
<artifactId>Models</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<artifactId>Utilities</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<artifactId>Services</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<artifactId>WebControllers</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>


<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<type>jar</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

我的 WebController 模块 pom.xml 如下:-

<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>WebControllers</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<java.version>1.8</java.version>
</properties>

<parent>
<artifactId>rstkapp</artifactId>
<groupId>com.salesforce</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<artifactId>Models</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<artifactId>Utilities</artifactId>
<groupId>com.salesforce</groupId>
</dependency>

<dependency>
<artifactId>Services</artifactId>
<groupId>com.salesforce</groupId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<type>jar</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

我还有一些其他模块的 pom.xml 文件,如果需要,我也会共享这些文件。

有时当我使用依赖项构建项目时它可以工作,有时则不能,我无法找出原因,如果项目有错误,为什么它有时会工作?

最佳答案

maven版本有两种

  1. 您可以通过命令 mvn --version 来确定

maven version

  • 位于 pom.xml 的插件部分
  • maven compile dependency version

    因此,通过在我的父 pom.xml 中添加以下代码:-

    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    </plugin>
    </plugins>

    </build>

    之前我使用的是maven版本3.1.1,通过将pom.xml中的maven版本从3.1.1更新到3.8.1,解决了这个问题。

    关于java - Maven 多模块清理和构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59411916/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com