Tôi là người mới sử dụng Gradle và Artifactory và tôi muốn tải tệp JAR lên Artifactory.
Đây là build.gradletệp của tôi :
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'artifactory-publish'
groupId = 'myGroup'
version = '1.0'
def artifactId = projectDir.name
def versionNumber = version
artifactory {
    contextUrl = 'http://path.to.artifactory' // base artifactory url
    publish {
        repository {
            repoKey = 'libs-releases'   // Artifactory repository key to publish to
            username = 'publisher'      // publisher user name
            password = '********'       // publisher password
            maven = true
        }
    }
}
artifactoryPublish { 
    dependsOn jar
}
Sau khi chạy artifactoryPublishtác vụ, quá trình xây dựng thành công như hình dưới đây:
> gradle artifactoryPublish  --stacktrace
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:artifactoryPublish
Deploying build info to: http://path.to.artifactory/api/build
BUILD SUCCESSFUL
Total time: 7.387 secs
Tuy nhiên, không có gì được gửi đến Artifactory ngoại trừ thông tin bản dựng.
Bất kỳ sự giúp đỡ sẽ được nhiều đánh giá cao.
Biên tập:
Như JBaruch đã đề cập, tôi đã thêm
apply plugin: 'maven-publish'
publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}
và phần mặc định cho tác vụ nhân tạo
defaults {
   publications ('mavenJava')
}
Bây giờ nó hoạt động.
Cảm ơn
defaultsthực sự đi vào bên trongartifactory.publish, không chỉ trongartifactorytác vụ root .