Problem with "uploadArchives"


(Raghav) #1

Hi all -

Here is an excerpt from my build.gradle

apply plugin: 'application’
mainClassName = "com.sff.DBMigrator"
distTar.enabled = false // We no need to run distTar
dependencies {
compile group: ‘com.oracle’, name: ‘ojdbc7’, version: '+'
compile group: ‘log4j’, name: ‘log4j’, version: '+'
compile(group: ‘com.microsoft’, name: ‘sqljdbc4’, version: ‘+’) {
//explicitly adding the dependency artifact:
artifact {
name = ‘sqljdbc42’ //artifact name different than module name
extension = 'jar’
type = ‘jar’
}
}
testCompile(
[group: ‘junit’, name: ‘junit’, version: ‘+’],
)
}

I do not want .tar file and I need only .zip file as an artifact. If you see, i disabled distTar.

But when I try to publish, it is failing at uploadArchives.

Execution failed for task ‘:dbm:uploadArchives’.
> Could not publish configuration ‘archives’
> Cannot publish artifact ‘com.sff.dbm.tar (com.dbm:dbm:1.0.0.0-SNAPSHOT)’ (D:\dbm\build\distributions\com.dbm.dbm-1.0.0.0-SNAPSHOT.tar) as it does not exist.

Can anyone suggest, what should I do to get only .zip?


(Raghav) #2

Found the solution.

configurations.archives.artifacts.removeAll {it.type == ‘tar’}

Addition of the above line, prevents the publish task from complaining about the missing tar artifact.