我正在尝试将工件发布到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'
}
}