繁体   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