当前位置: 首页 > 知识库问答 >
问题:

MVN依赖:升级少量依赖后脱机失败

司空通
2023-03-14

我从2.1.4升级了springboot。发布到2.3.3。该版本更新了几个其他依赖项。POM如下所示:

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 com。gn gservices 1.0.0-SNAPSHOT jar

<name>AbcXZ</name>
<description>AbcXZ Services</description>
<!--  
  <repositories>
    <repository>
      <id>groovy</id>
      <name>repo for groovy</name>
      <url>https://dl.bintray.com/groovy/maven/</url>
    </repository>
  </repositories> -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.3.RELEASE</version>
    <relativePath />
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>14</java.version>
</properties>
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>libraries-bom</artifactId>
      <version>4.3.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.firebase</groupId>
        <artifactId>firebase-admin</artifactId>
        <version>7.0.0</version>
    </dependency>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-firestore</artifactId>
      </dependency>
    <dependency>
        <groupId>com.vladmihalcea</groupId>
        <artifactId>hibernate-types-52</artifactId>
        <version>2.4.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-text</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-core</artifactId>
        <version>6.0.0-beta</version>
    </dependency>
    <dependency>
        <groupId>com.twilio.sdk</groupId>
        <artifactId>twilio</artifactId>
        <version>7.36.0</version>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.4</version>
    </dependency>
    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka</artifactId>
    </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20200518</version>
    </dependency>   
    <dependency>
        <groupId>org.mnode.ical4j</groupId>
        <artifactId>ical4j</artifactId>
        <version>3.0.14</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.2</version>
            <executions>
                <execution>
                    <id>install-common-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <classifier>common</classifier>
                        <includes>
                            <include>**/common/**/*.class</include>
                        </includes>
                        <finalName>abcxz</finalName>
                    </configuration>
                </execution>
                <execution>
                    <id>create-data-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <classifier>data</classifier>
                        <includes>
                            <include>**/entity/**/*.class</include>
                            <include>**/repositories/**/*.class</include>
                            <include>**/repository/**/*.class</include>
                        </includes>
                        <finalName>abcxz</finalName>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>3.0.0-M1</version>
            <executions>
                <execution>
                    <id>install-common-jar</id>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <phase>install</phase>
                    <configuration>
                        <groupId>com.abcxz</groupId>
                        <artifactId>abcxz-common</artifactId>
                        <version>0.1</version>
                        <packaging>jar</packaging>
                        <file>${basedir}/target/abcxz-common.jar</file>
                        <generatePom>false</generatePom>
                    </configuration>
                </execution>
                <execution>
                    <id>install-data-jar</id>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <phase>install</phase>
                    <configuration>
                        <groupId>com.abcxz</groupId>
                        <artifactId>abcxz-data</artifactId>
                        <version>0.1</version>
                        <packaging>jar</packaging>
                        <file>${basedir}/target/abcxz-data.jar</file>
                        <generatePom>false</generatePom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <release>14</release>
                <compilerArgs>
                    <arg>--enable-preview</arg>
                </compilerArgs>
                <forceJavacCompilerUse>true</forceJavacCompilerUse>
                <parameters>true</parameters>
            </configuration>
        </plugin>      
    </plugins>
</build>

当我运行依赖:离线它失败与以下错误:

无法执行目标org.apache.maven.plugins: maven-依赖插件: 3.1.2:去离线(default-cli)在项目gservice:org.eclipse.aether.resolution.依赖解决异常:找不到工件org.codehaus.groovy: groovy-all: jar: 2.5.4在中央(https://repo.maven.apache.org/maven2)

我试图添加https://dl.bintray.com/groovy/maven/作为额外的回购,但没有帮助。根据maven留档的依赖:离线:

"这个目标与调用mvn依赖项:解析依赖项:解析插件完全相同。"

但当我运行mvn dependency:resolve和mvn dependency:resolve plugins时,它是成功的。我花了很多时间想弄明白。如果有人有想法,请分享。

谢谢

共有1个答案

叶智
2023-03-14

我在升级spring boot starter父代时遇到了完全相同的问题,从2.2.4升级到2.3.8。就我而言,它包括这个罐子:

<dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-test</artifactId>
     <version>5.1.2.RELEASE</version>
     <scope>test</scope>
</dependency>

我的修复相对简单,因为我可以移除这个罐子,因为它实际上没有在项目中使用。通过快速了解您的依赖关系,这个罐子似乎:

<dependency>
    <groupId>org.mnode.ical4j</groupId>
    <artifactId>ical4j</artifactId>
    <version>3.0.14</version>
</dependency>

导入组织。科德豪斯。groovy jar,这可能是导致您出现问题的原因。

 类似资料:
  • 我升级了我的AS,错误开始出现 我找了所有的地方,但我不能解决问题 这是我的构建。gradle(项目),脱机是未检查的,我做了无效和重启没有工作, 什么意思不能解决依赖?这是我在gradle(应用程序)中添加存储库时得到的结果

  • 我添加hbase罐在我的客户项目使用mvn依赖 但是,mvn无法找到所需的版本,因此给出了错误消息。我自己检查了以下链接,但没有hbase-0.98。0-hadoop2。罐子就在那个地方。请帮忙 下载:http://repo1.maven.org/maven2/org/apache/hbase/hbase/0.98.0-hadoop2/hbase-0.98.0-hadoop2.jar[信息]找不到

  • 之后运行会导致 [ERROR]未能在Oxalis项目上执行goal org.apache.maven.Plugin:maven-surefire-plugin:3.0.0-M4:test(default-test)Tils:jar:1.1以前没有从它下载过。->[帮助1] (我启用了快照存储库,因为maven-dependency-plugin在多模块项目中存在严重问题,否则) POM包括 如上所

  • 在默认状态下,Maven 在 build 的时候不会包含所依赖的 jar 包。当运行一个 Spark 任务,如果 Spark worker 机器上没有包含所依赖的 jar 包会发生类无法找到的错误(ClassNotFoundException)。 有一个简单的方式,在 Maven 打包的时候创建 shaded 或 uber 任务可以让那些依赖的 jar 包很好地打包进去。 使用 <scope>pr

  • 我有两种服务a.service和b.service。a、 显示服务 b、 服务 现在,当我开始b.service,我确信a.service将被启动。在运行时,突然有人扰乱 /home/admin/run.sh和systemd无法启动a.service(也是systemctl状态a.service显示为状态失败)。现在有一个选项,b.service可以知道a.service失败,它应该停止/退出吗?