簡體   English   中英

如何從 Nexus 導入 maven 依賴項

[英]How to import maven dependencies from Nexus

我正在學習 Nexus 存儲庫。 並嘗試將工件上傳到 Nexus 上的 maven 存儲庫。 如何將它導入到我的 spring 引導項目中? 我已經通過 web 接口將 *.jar 文件上傳到我的存儲庫。 另外,我已經嘗試過了,但它沒有找到我的依賴項。

我收到了這個錯誤

> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find mygroup.myartifact:0.0.1:.

這是我嘗試過的

plugins {
    id 'org.springframework.boot' version '2.4.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example.project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    maven {
        url 'http://nexusUrl:8081/repository/my-repo'

        credentials {
            username = 'admin'
            password = 'admin123'
        }
    }
    mavenCentral()
}

dependencies {
        
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-cache'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'

    implementation 'mygroup.myartifact:0.0.1'
    
    ...
}

任何人都可以幫助我嗎?

您應該使用'mygroup:myartifact:0.0.1' (注意:而不是。)。 這假定mygroup是組, myartifact是工件名稱。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM