Ранее я успешно настроил учетные записи bintray и artifactory для публикации версий моментальных снимков в репозитории OSS JFrog Artifactory, но после настройки организации GitHub / Bintray / Artifactory под тем же пользователем я не могу публиковать снимки.
При попытке запустить
./gradlew artifactoryPublish -Dsnapshot=true -DbintrayUser=myBintrayUser -DbintrayKey=myBintrayApiKey -DbuildNumber=#
Я получаю следующую ошибку:
java.io.IOException: Failed to deploy file. Status code: 401 Response message: Artifactory returned the following errors:
Unauthorized Status code: 401
Я пытался использовать обоих пользователей bintray (моих сотрудников и организацию), но получил одинаковый ответ. Я также попытался восстановить новый ключ API на https://bintray.com/profile/edit,, но не сработал (и теперь, похоже, также не синхронизирован с ключом на https://oss.jfrog.org/artifactory/webapp/#/profile), который я не могу редактировать.
Файл build.gradle
:
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
}
plugins {
id 'java-library'
id 'maven'
id 'maven-publish'
// Automatic SEMVER
// ./gradlew release
id 'net.vivin.gradle-semantic-build-versioning' version '4.0.0' apply false
// SNAPSHOT publishing to oss-jfrog-artifactory
// ./gradlew artifactoryPublish -Dsnapshot=true -DbintrayUser=<YOUR_USER_NAME> -DbintrayKey=<YOUR_API_KEY> -DbuildNumber=NNN
id 'com.jfrog.artifactory' version '4.6.2'
// RELEASE publishing to bintray
// ./gradlew bintrayUpload -DbintrayUser=<YOUR_USER_NAME> -DbintrayKey=<YOUR_API_KEY>
id 'com.jfrog.bintray' version '1.8.1'
}
wrapper.gradleVersion = '4.5.1'
def groupName = 'noxtech'
group = 'uk.co.noxtech'
archivesBaseName = 'noxtech-java-utils'
description = 'Assorted Java 8 utilities'
def projectUrl = "https://github.com/noxtech/noxtech-java-utils"
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
api 'joda-time:joda-time:2.9.9'
implementation 'org.projectlombok:lombok:1.16.20'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc.failOnError = false
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
scm {
url projectUrl
}
}
publishing {
publications {
mavenPublication(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
groupId = project.group
artifactId = project.archivesBaseName
version = project.version.toString()
pom.withXml {
def root = asNode()
root.appendNode('description', project.description)
root.appendNode('name', project.name)
root.appendNode('url', projectUrl)
root.children().last() + pomConfig
}
}
}
repositories {
maven {
// change to point to your repo, e.g. http://my.org/repo
url "$buildDir/repo"
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
publications = ['mavenPublication']
pkg {
repo = "maven"
name = project.archivesBaseName
userOrg = groupName
licenses = ['Apache-2.0']
websiteUrl = projectUrl
vcsUrl = projectUrl + '.git'
issueTrackerUrl = projectUrl + '/issues'
version {
name = project.version.toString()
desc = project.description
vcsTag = project.version.toString()
released = new Date()
}
}
}
artifactory {
contextUrl = 'http://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
}
defaults {
publications('mavenPublication')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = 'jcenter'
}
clientConfig.info.setBuildNumber(project.hasProperty('buildNumber') ? project.property('buildNumber') : System.getenv('BUILD_NUMBER'))
}