简体   繁体   中英

Publishing artifact to remote maven repository on s3 using Gradle

I've been researching and trying to find examples for the above and found the following:

For Android Projects:

Hosting a Private Maven Repo on Amazon S3

gradle maven push project

These plugin however expects certain Android properties specified and throws errors like Could not find property 'android' on task ':androidJavadocs'.

For Remote repositories over SFTP , there is maven-publish .

Besides, it seems to be possible to do this in Maven .

Would be great if anyone can point me to an example of how to do this.

Gradle has a plugin to do this now however it is in incubating state and yet to be released.

https://docs.gradle.org/current/userguide/publishing_maven.html

I've slightly modified the code from your second link ( here ) for Java-based projects. The only problematic sections are at the bottom of the file, where the source and javadoc jars are being created since he is directly referencing Android. If you replace the final tasks (line 95 onwards) with the following it should resolve your problem:

task sourcesJar(type: Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

// Makes the Javadocs
task javadocs(type: Javadoc) {
    // I set this to false here since I reference third party classes in my Javadocs 
    //   which fails the Javadoc generation, but this can be removed
    failOnError  false
    source = sourceSets.main.java.srcDirs
}

task javadocJar(type: Jar, dependsOn: javadocs) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM