使用Gradle将zip文件发布到Nexus(Maven)

Lie*_*oen 5 nexus progress-4gl openedge gradle maven

假设您要使用Gradle上传到Nexus的PL文件.这样的剧本怎么样?

'be.mips'版本='1.4.0-SNAPSHOT'

在settings.gradle中 - > rootProject.name ='stomp'

让我们说pl文件位于子目录dist(./dist/stomp.pl)中.

现在我想将这个stomp.pl文件发布到nexus快照存储库.

只要你使用Java,那么Gradle(就像Maven一样)就像魅力一样.但是,如果您有DLL,ZIP或PL(进度库),那么很少有文档可以找到.

Vya*_*ets 11

我很长时间都会发布这样的文物.例如,ZIP存档包含SQL文件.让我举一个真实项目的例子:

build.gradle:

apply plugin: "base"
apply plugin: "maven"
apply plugin: "maven-publish"

repositories {
    maven { url defaultRepository }
}

task assembleArtifact(type: Zip, group: 'DB') {
    archiveName 'db.zip'
    destinationDir file("$buildDir/libs/")
    from "src/main/sql"
    description "Assemble archive $archiveName into ${relativePath(destinationDir)}"
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact source: assembleArtifact, extension: 'zip'
        }
    }
    repositories {
        maven {
            credentials {
                username nexusUsername
                password nexusPassword
            }
            url nexusRepo
        }
    }
}

assemble.dependsOn assembleArtifact
   build.dependsOn assemble
 publish.dependsOn build
Run Code Online (Sandbox Code Playgroud)

gradle.properties:

# Maven repository for publishing artifacts
nexusRepo=http://privatenexus/content/repositories/releases
nexusUsername=admin_user
nexusPassword=admin_password

# Maven repository for resolving artifacts
defaultRepository=http://privatenexus/content/groups/public

# Maven coordinates
group=demo.group.db
version=SNAPSHOT
Run Code Online (Sandbox Code Playgroud)