Ps I didn't say that I didn't say you could also use maven if you want a
serious build system (in part because you might be foolish and make the
mistake of using the "maven project" type in Jenkins and not do it right
[freestyle + maven build step] but anyway)

On Sunday, 10 June 2012, Arnaud Héritier wrote:

> You can probably reuse maven ant tasks for such deployment from gradle if
> you want something safe/clean.
>
> Arnaud
>
> PS : I didn't say that you may also use directly Maven if you want a
> serious build system even if it was tempting ;)
>
> Le 10 juin 2012 à 16:07, Stephen Connolly 
> <[email protected]<javascript:_e({}, 'cvml', 
> '[email protected]');>>
> a écrit :
>
> That misses out the deployment number which is required in the metadata. I
> suspect gradle only thinks it understands maven repos
>
> On Sunday, 10 June 2012, Grégory Boissinot wrote:
>
>> You can use the following snippet:
>>
>> import java.text.SimpleDateFormat;
>> import java.text.DateFormat;
>>
>> version=1.0
>>
>> Calendar calendar = Calendar.getInstance();
>> DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
>>
>> gradle.taskGraph.whenReady {
>>  String buildID = System.getenv()['BUILD_ID']
>>  if (buildID == null){
>>     buildID = dateFormat.format(calendar.getTime())
>>  }
>>  version = version + "-" +  buildID
>> }
>>
>> task display << {
>>  println version
>> }
>>
>> If this script is called by Gradle itself, the current date is used and
>> it is formatted with a pattern (free to externalize the pattern).
>> If the script is called by Jenkins, the BUILD_ID environment variable is
>> used (The BUILD_ID represents in JENKINS the job build time).
>> And you are able to format this variable  (use a different date pattern)
>> with the ZenTimestamp Jenkins plugin.
>>
>>
>> On Sun, Jun 3, 2012 at 8:03 PM, Yair Halevi <[email protected]> wrote:
>>
>>> I'm trying to build a CI workflow in my company, using Gradle, Jenkins
>>> and Artifactory. I'm new to all of these, so there's a chance I'm asking
>>> trivial questions.
>>>
>>> I've setup my repository to use unique snapshots, which require the
>>> versions to have a 14 digit timestamp. For example:
>>>
>>> 1.0.0-20120529100003
>>>
>>> But I'm having a hard time finding an easy way to generate these
>>> timestamps into the version. I was expecting that this would be
>>> automatically supported by either Jenkins or Gradle (I understand that
>>> Maven 3 has such a flow), but couldn't find any reference to such a
>>> capability.
>>>
>>> Am I supposed to code this in Gradle myself? Are there any best
>>> practices regarding how to do this? My Artifactory repository is configured
>>> for the gradle-default layout (ivy-like), not maven.
>>>
>>> Thanks
>>>
>>
>>

Reply via email to