On Jul 21, 2009, at 5:11 PM, Philip Crotwell wrote:

Hi

What I want to do is to create a lib directory that contains all of
the jars for a project, both directly generated as well as
dependencies. The idea is to the create a distribution tar that
contains a lib dir with all needed jars and a bin that contains
scripts to run using the items in lib. I have a simple copy task that
mostly does this, but jars from dependency multi-projects do not have
the version, while jars from dependencies do. This is because jar
files in .gradle/internal-repository do not have the version in the
filename, ie they are named something like:
.gradle/internal-repository/edu.sc.seis/seisFile/1.0.6/jars/ seisFile.jar

I realize the version is in the directory name, but wouldn't it be
better also to name the actual jar along with the recommendations
within the user guide, ie seisFile-1.0.6.jar?

task copyToLib(dependsOn: uploadArchives) << {
   libDir = new File('test/output/lib')
   libDir.mkdirs()
   configurations.default.each { File file -> ant.copy(file:
file.path, toDir: libDir) }
   repositories { flatDir(dirs: libDir) }
}

uploadArchives {
   libDir = new File('test/output/lib')
   libDir.mkdirs()
   repositories {
      flatDir(dirs: libDir)
   }
}

Or is there a better way of creating a lib dir with all needed jars
and with the name-version.jar naming scheme? Perhaps something similar
to uploadArchives that handles dependencies?

There is probably a better way.

task copyToLib(dependsOn: libs) {
   libDir = new File('test/output/lib')
   libDir.mkdirs()
   configurations.default.each { ... }
   configurations.default.allArtifacts.each { artifact ->
      ant.copy(file: artifact.file, todir: libDir)
   }
}

You don't need the uploading for this.

BTW: For 0.8 we want to provide methods to a configuration that allows you to copy things: configurations.default.copy(...)

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to