On 27/03/10 5:43 PM, Geronimo M. H. wrote:
Hello,
I'm using this working copy-definition
copy {
from artifacts
into artDir
}
now I'd like to change the task to a file-based processing like I use with
dependencies:
for(file in configurations.runtime) {
...
}
whatever I tried failed, so I had a look at DefaultArtifactHandler - but I did
not find a hint to proceed ...
So how can I access the artifact as a File-instance?
Which artifacts do you need to access? The ones that the project
produces (eg the jar) or the ones that come from dependencies? Something
else?
Assuming you're after the artifacts the build produces, you can do
something like:
for (file in configurations.archives.allArtifactFiles) {
}
copy {
from configurations.archives.allArtifactFiles
into artifactsDir
}
That is, the Configuration class provides access to both the incoming
files for dependencies and the outgoing files for artifacts. Which, to
me, is kind of odd. After the 0.9 release, we're planning to split
Configuration into the dependency bits and the artifact bits, so that
instead, you'd do something like:
for ( file in dependencies.runtime ) { ... } // get the runtime dependencies
for (file in artifacts.archives ) { ... } // get the archive artifacts
This should read better, and also make it a bit easier to find the stuff
you want on the API. For example, if you're trying to find how to get
the artifacts, you're more likely to look at Project.getArtifacts() than
you are to look at Project.getConfigurations()
Anyway, we will discuss this further on the dev list before we start to
make changes here.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email