无法使用gradle连接到我的nexus存储库

时间:2017-01-22 01:06:25

标签: java gradle nexus

我已经关注了build.gradle文件:

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'eclipse'
buildscript {

repositories {
    maven {
      url "<myURL>/nexus/content/groups/public"
   }
}
    dependencies {

    }
}


jar {
   baseName = 'myAppName'
   version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {

maven {
      url "<myURL>/nexus/content/groups/public/"
      credentials {
        username "nexusUser"
        password "nexusPassword"
    }
}
maven {
      url "<myURL>/nexus/content/repositories/snapshots"
      credentials {
        username "nexusUser"
        password "nexusPassword"
    }
}
}
dependencies {

compile group: 'javax', name: 'javaee-api', version: '7.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.5'
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.10.19'
}

uploadArchives {

repositories {
   mavenDeployer {
         repository(url: "<myURL>/content/repositories/releases") {
            authentication(userName: nexusUsername, password: nexusPassword)
          }
         snapshotRepository(url: "<myURL>/nexus/content/repositories/snapshots") {
         authentication(userName: nexusUsername, password: nexusPassword)
    }

         pom.version = "0.0.1-SNAPSHOT"
         pom.artifactId = "app-name-commons"
         pom.groupId = "de.commons"
   }
}
}

我的问题是我无法将工件上传到我的nexus repo nore我得到了像javaee-api等依赖项。凭证在gradle.properties文件中定义。有没有人暗示为什么这不起作用?

更新

如果我让匿名用户可以读取存储库,我会得到依赖项。所以似乎问题是登录。

0 个答案:

没有答案