简体   繁体   English

用vscode运行Java Maven项目遇到一些错误

[英]Running Java Maven project with vscode encountered some errors

Here is my error这是我的错误

Project build error: Non-resolvable parent POM for com.aftermath:guli_parent:0.0.1-SNAPSHOT: org.springframework.boot:spring-boot-starter-parent:pom:2.2.1.RELEASE failed to transfer from http://maven.aliyun.com/nexus/content/groups/public during a previous attempt.项目构建错误:com.aftermath:guli_parent:0.0.1-SNAPSHOT:org.springframework.boot:spring-boot-starter-parent:pom:2.2.1.RELEASE 的不可解析父 POM 无法从Z80791B3AE7002CB88C246876D9FAA8转移/maven.aliyun.com/nexus/content/groups/public在之前的尝试中。 This failure was cached in the local repository and resolution is not reattempted until the update interval of alimaven has elapsed or updates are forced.此故障已缓存在本地存储库中,并且在 alimaven 的更新间隔已过或强制更新之前不会重新尝试解决。 Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.1.RELEASE from/to alimaven ( http://maven.aliyun.com/nexus/content/groups/public ): Connect timed out and 'parent.relativePath' points at no local POMJava(0)原始错误:无法将工件 org.springframework.boot:spring-boot-starter-parent:pom:2.2.1.RELEASE 从 / 转移到 alimaven ( http://maven.aliyun.com/nexus/content/groups/public ): 连接超时并且 'parent.relativePath' 点没有本地 POMJava(0)

Here is my code这是我的代码

<?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>
    <modules>
        <module>service</module>
        <module>commom</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.aftermath</groupId>
    <artifactId>guli_parent</artifactId>
    <packaging>pom</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>guli_parent</name>
    <description>guli_parent</description>
    <properties>
        <java.version>11</java.version>
        <guli.version>0.0.1-SNAPSHOT</guli.version>
        <mybatis-plus.version>3.0.5</mybatis-plus.version>
        <velocity.version>2.3</velocity.version>
        <swagger.version>3.0.0</swagger.version>
        <aliyun.oss.version>2.8.3</aliyun.oss.version>
        <jodatime.version>2.10.1</jodatime.version>
        <poi.version>5.2.2</poi.version>
        <commons-fileupload.version>1.4</commons-fileupload.version>
        <commons-io.version>2.11.0</commons-io.version>
        <httpclient.version>4.5.13</httpclient.version>
        <jwt.version>0.7.0</jwt.version>
        <aliyun-java-sdk-core.version>4.3.3</aliyun-java-sdk-core.version>
        <aliyun-sdk-oss.version>3.1.0</aliyun-sdk-oss.version>
        <aliyun-java-sdk-vod.version>2.15.2</aliyun-java-sdk-vod.version>
        <aliyun-java-vod-upload.version>1.4.11</aliyun-java-vod-upload.version>
        <aliyun-sdk-vod-upload.version>1.4.11</aliyun-sdk-vod-upload.version>
        <fastjson.version>2.0.11.graal</fastjson.version>
        <gson.version>2.9.0</gson.version>
        <json.version>20170516</json.version>
        <commons-dbutils.version>1.7</commons-dbutils.version>
        <canal.client.version>1.1.0</canal.client.version>
        <docker.image.prefix>zx</docker.image.prefix>
        <cloud-alibaba.version>0.2.2.RELEASE</cloud-alibaba.version>
    </properties>
    <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <version>1.0</version>
        </dependency>
        <!--Spring Cloud-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Hoxton.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-alibaba-dependencies</artifactId>
            <version>${cloud-alibaba.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <!--mybatis-plus 持久层-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${mybatis-plus.version}</version>
        </dependency>
        <!-- velocity 模板引擎, Mybatis Plus 代码生成器需要 -->
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity-engine-core</artifactId>
            <version>${velocity.version}</version>
        </dependency>
        <!--swagger-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <!--swagger ui-->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <!--aliyunOSS-->
        <dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>3.1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- no more than 2.3.3-->
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.3.3</version>
        </dependency>
        <!--日期时间工具-->
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${jodatime.version}</version>
        </dependency>
        <!--xls-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <!--xlsx-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <!--文件上传-->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>${commons-fileupload.version}</version>
        </dependency>
        <!--commons-io-->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>
        <!--httpclient-->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>
        <!-- JWT -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>${jwt.version}</version>
        </dependency>
        <!--aliyun-->
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>${aliyun-java-sdk-core.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>${aliyun-sdk-oss.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-vod</artifactId>
            <version>${aliyun-java-sdk-vod.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-vod-upload</artifactId>
            <version>${aliyun-java-vod-upload.version}</version>
        </dependency>

        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-sdk-vod-upload</artifactId>
            <version>${aliyun-sdk-vod-upload.version}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>${fastjson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${json.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>${commons-dbutils.version}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.otter</groupId>
            <artifactId>canal.client</artifactId>
            <version>${canal.client.version}</version>
        </dependency>
    </dependencies>
    </dependencyManagement>


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

</project>

I found a similar error and tried command mvn dependency:purge-local-repository but also encountered an error我发现了一个类似的错误并尝试了命令mvn dependency:purge-local-repository但也遇到了错误

[INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.aliyun.oss:aliyun-sdk-oss:jar -> duplicate declaration of version 3.1.0 @ com.aftermath:guli_parent:0.0.1-SNAPSHOT, D:\code\atguigu\gulixueyuan\guli_parent\pom.xml, line 169, column 21 [ERROR] 'modules.module[2]' specifies duplicate child module service_oss @ line 17, column 17 [WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.aliyun.oss:aliyun-sdk-oss:jar -> duplicate declaration of version 3.1.0 @ line 169, column 21 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [INFO] 正在扫描项目... [ERROR] [ERROR] 处理 POM 时遇到一些问题:[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' 必须是唯一的:com。 aliyun.oss:aliyun-sdk-oss:jar -> duplicate declaration of version 3.1.0 @ com.aftermath:guli_parent:0.0.1-SNAPSHOT, D:\code\atguigu\gulixueyuan\guli_parent\pom.xml, line 169 ,第 21 列 [ERROR] 'modules.module[2]' 指定重复的子模块 service_oss @ 第 17 行,第 17 列 [WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' 必须是唯一的:com .aliyun.oss:aliyun-sdk-oss:jar -> 3.1.0 版本重复声明@第 169 行第 21 列 @ [错误] 构建无法读取 1 个项目 -> [帮助 1] [错误]
[ERROR] The project com.aftermath:service:0.0.1-SNAPSHOT (D:\code\atguigu\gulixueyuan\guli_parent\service\pom.xml) has 1 error [ERROR] 'modules.module[2]' specifies duplicate child module service_oss @ line 17, column 17 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [错误] 项目 com.aftermath:service:0.0.1-SNAPSHOT (D:\code\atguigu\gulixueyuan\guli_parent\service\pom.xml) 有 1 个错误 [错误] 'modules.module[2]' 指定重复child module service_oss @ line 17, column 17 [ERROR] [ERROR] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。 [ERROR] Re-run Maven using the -X switch to enable full debug logging. [错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。 [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [ERROR] 有关错误和可能的解决方案的更多信息,请阅读以下文章: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

I don't know what to do next.我不知道下一步该做什么。 This is the first time I use vscode to run Java Maven project.这是我第一次使用vscode运行Java Maven项目。 Is there any configuration missing?是否缺少任何配置? Ask for help请求帮忙

You have a duplicate dependency in lines 96 & 171您在第 96 行和第 171 行中有重复的依赖项

        <dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>${aliyun-sdk-oss.version}</version>
        </dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM