猿问

Maven:在尝试在线之前如何配置以使用本地存在的工件 (~/.m2/repository)?

在本地有两个 maven 项目,即Authentication和Commons,我需要使用 Commons 作为 Authentication 的 pom.xml 中的依赖项,在 Commons 根目录中~/.m2/repository运行后正确部署在本地存储库中mvn clean install。


但是,当我maven clean install在身份验证根目录中运行时,我不知道如何阻止它尝试从在线下载此本地依赖项。


这是我得到的错误:


[ERROR] Failed to execute goal on project authentication: Could not resolve dependencies for project io.project:authentication:jar:0.0.1-SNAPSHOT: Failure to find io.project.commons:project-commons:jar:0.0.1.RELEASE in https://repo.spring.io/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring-snapshots has elapsed or updates are forced

这是的pom Authentication:


http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0


<groupId>io.project</groupId>

<artifactId>authentication</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>jar</packaging>


<name>authentication</name>

<description>Demo project for Spring Boot</description>


<parent>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-parent</artifactId>

    <version>2.0.5.BUILD-SNAPSHOT</version>

    <relativePath/> <!-- lookup parent from repository -->

</parent>


<properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

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

    <spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>

</properties>


<dependencies>

    <dependency>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-web</artifactId>

    </dependency>


    <dependency>

        <groupId>org.springframework.cloud</groupId>

        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>

    </dependency>


    <dependency>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-security</artifactId>

    </dependency>


牛魔王的故事
浏览 207回答 1
1回答

Qyouu

看看你的坐标。在身份验证中,您依赖于io.project.commons:project-commons:<dependency>&nbsp; &nbsp; <groupId>io.project.commons</groupId>&nbsp; &nbsp; <artifactId>project-commons</artifactId>&nbsp; &nbsp; <version>0.0.1.RELEASE</version></dependency>但公共项目的实际坐标是io.project:project-commons:<groupId>io.project</groupId><artifactId>project-commons</artifactId>
随时随地看视频慕课网APP

相关分类

Java
我要回答