Added Gradle support.
--- a/maven-central.el Mon Jul 31 17:43:35 2017 +0300
+++ b/maven-central.el Sun Aug 27 23:12:42 2017 +0300
@@ -115,6 +115,37 @@
(maven-central/versions groupId artifactId))
))
+(defun maven-central/parse-gradle-dependency ()
+ (let ( groupId artifactId )
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (when (re-search-forward "\\([\"']\\)\\([a-zA-Z0-9.-]+\\):\\([a-zA-Z0-9.-]+\\):?[a-zA-Z0-9.-]*\\1" (line-end-position) t)
+ (setq groupId (match-string 2))
+ (setq artifactId (match-string 3))
+ (list groupId artifactId)))))
+
+;;;###autoload
+(defun maven-central-last-version-from-gradle ()
+ (interactive)
+ (let (dependency groupId artifactId)
+ (setq dependency (maven-central/parse-gradle-dependency))
+ (setq groupId (elt dependency 0))
+ (setq artifactId (elt dependency 1))
+ (when (and groupId artifactId)
+ (maven-central/last-version groupId artifactId))
+ ))
+
+;;;###autoload
+(defun maven-central-versions-from-gradle ()
+ (interactive)
+ (let (dependency groupId artifactId)
+ (setq dependency (maven-central/parse-gradle-dependency))
+ (setq groupId (elt dependency 0))
+ (setq artifactId (elt dependency 1))
+ (when (and groupId artifactId)
+ (maven-central/versions groupId artifactId))
+ ))
+
;; (maven-central/last-version "junit" "junit")
(provide 'maven-central)