Rene Groeschke wrote:
Hello gradle.

In my spare time I try to move my eclipse rcp releng project from pde-build to gradle.

I use the following lines of gradle script to package my whole application including third party eclipse bundles:

    dependencies {
addFlatDirResolver('lib', target_plugins).addArtifactPattern(target_plugins+'/[artifact]_[revision].[ext]')
        compile rcp_bundles
    }

    dists {
        zip() {
files(dependencies.resolve("runtime")) // add dependencies to zip }
    }


but this produces the following error message:
Build file '/Users/Rene/workspaces/sandbox/gradle/com.breskeby.samples.gradlercp.rcp/build.gradle' line(s): 38, 37, 36

    A problem occurred evaluating project :.
    Cause: [Ljava.util.ArrayList;

The line which causes this error is:
    file(dependencies.resolve("runtime"))

anybody an idea?


This error is because the return type of resolve() is List, and the parameter of files() is String[].

To work around this, you can do something like:

files(dependencies.resolve("runtime") as String[])

One thing to note is that the closure passed to zip() is executed when the project is evaluated, not when the zip task is executed. Not everything in the 'runtime' configuration will necessarily available at that point, if the configuration includes dependencies from other projects. In that case, you need something like:

dists {
   zip() {
       doFirst { task ->
           task.files(dependencies.resolve("runtime"))
   }
}

It would be good if we had a nicer way to include the artifacts from a configuration in an archive which dealt with the above issues. For example, if we had a Configuration domain object and it implemented FileCollection, you could just add the configuration object to the archive.


Adam

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

   http://xircles.codehaus.org/manage_email


Reply via email to