On Jun 16, 2009, at 11:40 AM, Donal Mc Namee wrote:
I'm having difficulty publishing an artifact to my local Ivy
repository
with "gradle uploadArchives".
I have one project called 'ias_ta_common' that creates 2 Jars
('ias_ta_common.jar', and 'ias_ta_common_service_facade.jar')
Calling "gradle uploadArchives" will upload my 'ias_ta_common.jar' as
expected but I can't seem to find a way for it to publish the extra
Jar.
Looking at the documentation under "Artifact management" it would
appear
that assigning the artifact to the 'archives' configuration should be
enough.
Can anyone see what I'm doing wrong?. My build.gradle is as follows:
--------------------------------->8----------------------------------
usePlugin 'java'
srcRootName="sources"
srcDirNames = ['ie']
group = 'vhi'
version = '1.0'
repositories{
add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
name = 'ivyLocalRepository'
addIvyPattern
"C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/
ivys/iv
y.xml"
addArtifactPattern
"C:/apps/ivy-local-repository/[organisation]/[module]/[revision]/
[ext]s/
[artifact].[ext]"
descriptor = 'optional'
checkmodified = true
}
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections',
version: '3.2'
}
task serviceFacade(type: Jar, dependsOn: compile){
configuration = configurations.archives
ant.jar(destfile:
"$buildDir/libs/ias_ta_common_service_facade-${version}.jar") {
fileset(dir: "$classesDir") {
include(name: "ie/vhi/ias/ta/common/services/facade/**")
}
}
}
The problem lies here. You are creating an archive with Ant in the
configuration closure of a Jar task. In fact this archive won't
contain anything. At least not after a clean. As this is executed
before any Gradle task is executed. And you don't configure the actual
serviceFacade task to produce the archive. Instead you can do:
task serviceFacade(type: Jar, dependsOn: compile) {
baseName = 'ias_ta_common_service_facade'
fileSet(dir: classesDir) {
include("ie/vhi/ias/ta/common/services/facade/**")
}
}
I haven't tried it out but it should work.
See also section 15.12 of the UG:
http://gradle.org/0.6.1/docs/userguide/java_plugin.html#N112D5
artifacts {
archives serviceFacade
}
uploadArchives {
uploadDescriptor = true
repositories{
add project.repositories.ivyLocalRepository
}
}
- Hans
--
Hans Dockter
Gradle Project Manager
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email