Hi Marko,

On Jul 3, 2008, at 11:01 AM, Marko Bauhardt wrote:

Hi,
i try to create a distrubution (zip file) for our project. this zip should contain 3 directories:

bin - shell scripts
conf - configuration files
lib - all jar files

i try to realize this with this task:

---
dists {
  String zipRoot = "$archivesBaseName-$version"

  zip() {
zipFileSet(dir: file('src/main/scripts'), prefix: "$zipRoot/ bin", fileMode: '775') zipFileSet(dir: file('src/main/resources'), prefix: "$zipRoot/ conf")
    zipFileSet(dir: runtimeLibsDir, prefix: "$zipRoot/lib")
  }

}
---

Everything look ok, but the jar of my project is not included in the lib folder of this zip archive. so i add this line to the zip task

---
zipFileSet(dir: buildDir, includes: file ("$myProject_jar.archivePath"), prefix: "$zipRoot/lib")

First: myProject_jar.archivePath is already a file object (no need to transform it to a String and back to a file).

The ZipFileSet has an includes property which is of type Set. To make the above work you have to say:

zipFileSet(includes: ['somepath'], ...)

or (via the include method of the ZipFileSet)

zipFileSet(....).include('somepath')

and similarly

zipFileSet(...) {
    include('somepath')
}

- Hans

---

after that i get this exception:


Build aborted anormally because of an internal error. Run with -d option to get additonal debug info. Please file an issue at: www.gradle.org
Exception is:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'PATH_TO_MY_JAR' with class 'java.io.File' to class 'java.util.LinkedHashSet' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.cas tToType(DefaultTypeTransformation.java:340) at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java: 1994) at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java: 2587) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:910) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:754) at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod (InvokerHelper.java:765) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:753) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:167) at org.gradle.api.tasks.util.FileSet.setProperty (FileSet.groovy) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectPrope rty(ScriptBytecodeAdapter.java:559) at org.gradle.api.tasks.util.PatternSet$_closure1.doCall (PatternSet.groovy:37)


Any idea how i can include my project jar file in the lib directory of the zip file?

thanks for any hint
marko




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

   http://xircles.codehaus.org/manage_email



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





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

   http://xircles.codehaus.org/manage_email


Reply via email to