Hi all,
I’m bit confused about behaviour of my gradle build. I’m trying to create simple build file which would do following (as experiment): 1, take configuration folder 2, package it into Zip format 3, upload Zip to nexus
However, I got stuck on default Jar artifact which gets uploaded together with my Zip. Is there a way how to tell gradle, that all I really want to do, is simply upload Zip and nothing else? (I have no Jar task defined in my build, only Zip)
apply plugin: 'java'
defaultTasks 'createZip'
def resultZipName = 'myzip'
def resultZipDir = '/zip'
repositories {
mavenCentral()
}
dependencies {
// for testing transitive dependencies
compile 'org.hibernate:hibernate-core:4.1.7.Final'
}
task createZip(type: Zip) {
from '/'
include 'conf/**'
include 'build.gradle'
setBaseName(resultZipName)
destinationDir = file(resultZipDir)
}
artifacts {
archives createZip
}
task cleanZip(type: Delete) {
delete resultZipDir
}
uploadArchives {
repositories {
maven {
credentials {
username 'admin'
password 'admin123'
}
name = 'nexus-local'
url = 'http://localhost:8081/nexus/content/repositories/snapshots/'
}
}
}
Results in following:
:createZip
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:uploadArchives
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/Gradle-unspecified.jar
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/Gradle-unspecified.jar.sha1
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/gradle-zip-unspecified.zip
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/gradle-zip-unspecified.zip.sha1
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/ivy-unspecified.xml
Upload to http://localhost:8081/nexus/content/repositories/snapshots//gradle/unspecified/ivy-unspecified.xml.sha1