4

I use the distZip task to create my distribution. The distribution name is 'baseName'-'version'.zip at the moment. I want to use as classifier the current timestamp, i.e. the time of the build.

I tried using

distZip {
    classifier new Date().getTime()
}

but then I get the following error:

Could not find method classifier() for arguments [1421317243316] on root project

Doing the Java trick with

new Date().getTime() + ''

did not help. Anyone an idea?

Would also be good to know if I can extract year, month and day from the object.

akohout
  • 1,802
  • 3
  • 23
  • 42

1 Answers1

5

Here, classifier is a property and not a method. Hence, you need to use assignment (=) to assign the value to the property.

distZip {
    classifier = new Date().getTime()
}

To get date components, you can use Calendar object in java. Take a look at this.

Community
  • 1
  • 1
Invisible Arrow
  • 4,625
  • 2
  • 23
  • 31