ok resolved it my self .. in case some body needs :

==================

import groovy.json.JsonSlurper
def list = new JsonSlurper().parseText( new URL( '
http://repo.mycompany.com/api/search/versions?g=yourgroupID&a=yourartifactname&repos=yourrepo'
).text )
def versionList = list.results.version

=================

On Wed, Nov 12, 2014 at 2:48 PM, Rajwinder Makkar <[email protected]>
wrote:

> I am trying to list "only" version numbers using Groovy from artifactory
> pro ( 3.3.0 ) , I found a code spinet :
>
> ==============
>
> @Grab(group='org.apache.httpcomponents', module='httpclient',
> version='4.3.2' )
> import org.apache.http.HttpResponse;
> import org.apache.http.client.HttpClient;
> import org.apache.http.HttpEntity;
> import org.apache.http.util.EntityUtils
> import org.apache.http.client.methods.HttpGet;
> import org.apache.http.entity.InputStreamEntity;
> import org.apache.http.impl.client.DefaultHttpClient;
>
> def url = "http://repo.mycompnay.com/release/myartifact/";;
> HttpGet request = new HttpGet(url);
> DefaultHttpClient client = new DefaultHttpClient();
> HttpResponse response = client.execute(request);
>
> HttpEntity entity = response.getEntity();
> String responseString = EntityUtils.toString(entity, "UTF-8");
> println responseString
>
> ===========================
>
> But this gives almost an html output :
>
> ===================
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
> <html>
> <head>
> <title>Index of release/myartifact</title>
> </head>
> <body>
> <h1>Index of release/myartifact</h1>
> <pre>Name                     Last modified      Size</pre>
> <hr/>
> <pre><a href="../">../</a>
> <a href="1.0.0-SNAPSHOT/">1.0.0-SNAPSHOT/</a>           09-Jul-2013 17:56
>    -
> <a href="1.0.0.0/">1.0.0.0/</a>                  18-Jul-2013 00:34    -
> <a href="1.0.7.0/">1.0.7.0/</a>                  11-Nov-2014 22:37    -
> <a href="maven-metadata.xml">maven-metadata.xml</a>       11-Nov-2014
> 23:01  486 bytes
> <a href="maven-metadata.xml.md5">maven-metadata.xml.md5</a>   11-Nov-2014
> 23:01 32 bytes
> <a href="maven-metadata.xml.sha1">maven-metadata.xml.sha1</a>  11-Nov-2014
> 23:01  40 bytes
> </pre>
> <hr/>
> <address style="font-size:small;">Artifactory/3.3.0 Server at
> repo.mycompany.com Port 80</address>
> </body>
> </html>
> =============================
>
> But what i am looking for is :
>
> 1.0.0-SNAPSHOT
> 1.0.0.0
> 1.0.7.0
> =============================
>
> Any suggestions
>
> -raj
>
>
>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to