• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

How to enumerate jar versions on http://mvnrepository.com/artifact/org.apache.derby/derbyclient

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did some boogle searching and found some examples of using curl to download the latest version using the nexus REST API.

Most the the examples I found were for sonatype.com and they used a password and username. I don't have a password and username and it was not clear to me how to adapt the example for a different repository like the mvnrepository.com.

I want to enumerate the versions of (for example) the derby jdbc client like I see at http://mvnrepository.com/artifact/org.apache.derby/derbyclient.

What is the curl command I could use to do this?

Thanks
Siegfried
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maven repositories follow a standard format. You can easily enumerate all the artifacts by browsing through the maven repository. You don't need a REST API (although it would be nice to have one) mvnrepository.com, despite the URL, isn;t the maven repository. It's just a website built on top of the real maven repository. The real maven repository is at http://central.maven.org/maven2/

So, what you can do is write a program that
a) opens up a connection to http://central.maven.org/maven2/org/apache/derby/derbyclient/
b) gets the response which is an HTML file. THe HTML file will list out all the versions of the module
c) Parse the HTML file.
 
Siegfried Heintze
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had abandoned that idea because I was worried about the format changing...

But you say it is Standard? Really?
That is good news....
Does that mean the format will never change?

Wow! OK! I just took a look... That looks like pretty minimal formatting... I guess that would work and I won't worry about a REST interface then. What a surprise!
Is this minimal format also used by the other repositories like the JBOSS and eclipse maven repositories?

Sound like a job for a groovy script using the httpclient html parser...

Thanks
Siegfried
P.S. I would click on the question answered button if there was one!
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, if the format changes, maven builds will fail all over the world. They might change the format when a major version of maven comes out.

If you are making a Mojo, you might have a way to do this using the Maven api. I don;t know enough to give you an answer. However, if do a little digging, you might find an API that maven provides. of course, you will be able to use it inside a Mojo only
 
Siegfried Heintze
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, well now I'm glad there is no "question is answer checkbox" or I would have to uncheck it!

Why does not wget http://central.maven.org/maven2/org/apache/derby/derbyclient/ work?
Here is the result:



Ok, but here is what I get from my little groovy program that does work (what a surprise!).
My question is: how do I know what the versions are? What regex can I use? should I assume that are always numeric with periods in between? I don't think that is a good assumption.



Can someone help me modify my little groovy program so it only prints the version numbers?
Thanks
Siegfried

 
I am going to test your electrical conductivity with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic