jQuery Maven Artifact Plugin

jQuery plugin which fetches the latest version of a Maven artifact from the central repos.

Example: Latest version

$.fn.artifactVersion({
  'groupId': 'com.squareup',
  'artifactId': 'otto'
}, function(version, url) {
  $('.download').attr('href', url);
  $('.version').text('Version ' + version);
});

Example: Newest versions

$.fn.artifactVersions({
  'groupId': 'com.squareup.spoon',
  'artifactId': 'spoon-client'
}, function(versions) {
  $.each(versions, function() {
    $('.versions').append(
      $('<li>').append(
        $('<a>').attr('href', this.url).text(this.name)
      )
    );
  });
});

Result:

Spoon client versions:

    Example: Classifier

    $.fn.artifactVersion({
      'groupId': 'com.squareup.okhttp',
      'artifactId': 'okhttp',
      'classifier': 'jar-with-dependencies'
    }, function(version, url) {
      $('.download').attr('href', url);
      $('.version').text('Version ' + version);
    });

    Example: Packaging

    $.fn.artifactVersion({
      'groupId': 'net.simonvt.messagebar',
      'artifactId': 'messagebar',
      'packaging': 'aar'
    }, function(version, url) {
      $('.download').attr('href', url);
      $('.version').text('Version ' + version);
    });