Hello there,
I’ve been trying to publish and download a custom artifact since two days. As repository software I use Archiva from Apache (http://archiva.apache.org/index.cgi).
The idea is to publish a full and shrinked database-dump. Both as Snapshots. For each task-call, the dependency should be updated.
If I follow the userguide (http://www.gradle.org/docs/current/userguide/publishing_maven.html), and publish a Java Jar, all works fine.
With a custom artifact I get the Jar only if I remove the packaging from the pom-file. But only for the first checkout.
Any further try it doesnt download a new jar. Gradle just shows me the local place of the file (path to the Gradle-Cache).
If I dont prepare the POM-File Gradle download the pom (without the jar)… and thats it. Every retry ends in a “empty” ouput.
Command: gradle testit --refresh-dependencies My EndUserScript:
apply plugin: 'maven'
apply plugin: 'java'
repositories {
maven {
credentials {
username 'xxx'
password 'xxx'
}
url "xxx/archiva/repository/snapshots"
}
}
configurations {
downloadArchives
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 1, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 1, 'seconds'
}
dependencies {
downloadArchives group: 'de.fitz.dumps', name: 'shrinkedDump', version: '1.0-SNAPSHOT'
}
task testit << {
configurations.downloadArchives.each { File file -> println file.path }
}
My PublishScript
apply plugin: 'java'
apply plugin: 'maven-publish'
task sourceJar(type: Jar) {
from '.'
include '*.txt'
}
publishing {
repositories {
maven {
url "xxx/archiva/repository/snapshots/"
credentials {
username = "xxx";
password = "xxx";
}
}
}
publications {
shrinkedDumpPublication(MavenPublication) {
groupId = 'de.fitz.dumps'
artifactId = 'shrinkedDump'
version = '1.0-SNAPSHOT'
/*artifact sourceJar {
classifier "text"
extension "jar"
}*/
//from components.java
artifact source: 'README.txt', classifier: 'text', extension: 'txt'
pom.withXml {
asNode().remove(asNode().get("packaging"));
}
}
}
}