如何将增量工件发布到maven存储库(nexus)?

时间:2017-06-08 15:34:45

标签: gradle incremental-build gradle-3.0

我正在尝试将工件发布到snapshot中的nexus存储库。我正在尝试执行下面的代码。基本上它是incrementalPublish。如果模块中有任何更改,则gradle将构建,此任务将在snapshot中将其发布到nexus存储库.Below任务是在maven本地发布内容但希望在nexus中发布。

apply plugin: 'maven-publish'

    publishing {
    publications {
        mavenJava(MavenPublication) {
        reposiotry "https://repo.t.com/content/repositories/snapshots"
        authentication(userName: "user", password: "******")
        artifact jar
        }
    }
}

task incrementalPublishToMavenRepository(type: IncrementalPublishToMavenRepository) {
  inputDir = file('.')
  publication = project.tasks.getByPath(":${project.name}:publishMavenJavaPublicationToMavenRepository").publication
}

class IncrementalPublishToMavenRepository extends org.gradle.api.publish.maven.tasks.PublishToMavenRepository {
    @InputDirectory
    def File inputDir

    @OutputDirectory
    File generatedFileDir = project.file("${project.buildDir}/libs")

    @TaskAction
    void perform(IncrementalTaskInputs inputs) {
        println 'hello this should be executed ones'
    }
}

0 个答案:

没有答案