maven-central.el
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 10 Mar 2014 22:14:13 +0200
changeset 1118 ece4746ba12e
parent 1109 09d967bff50f
child 1143 a7fb97ff9cb6
permissions -rw-r--r--
Mark unmarked articles in current thread as read and move to next thread without selecting article.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1082
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
;;; maven-central.el --- Maven central auxility
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
;;; Commentary:
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
;;
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
1091
bbe864449f48 Fix dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1082
diff changeset
     6
(require 'json)
1082
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
(require 'url-handlers)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
;;; Code:
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
(defvar maven-central.buffer-name "*Maven Central*")
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
(defconst maven-central.search-url "http://search.maven.org/solrsearch/select?wt=json&rows=20")
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
(defun maven-central.callback1 (status)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
  (let ( (buffer (current-buffer)) )
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
    (switch-to-buffer maven-central.buffer-name)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
    (url-insert buffer)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
(defun maven-central.versions-url (groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
  (concat maven-central.search-url "&core=gav&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
;; (maven-central.versions-url "junit" "junit")
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
(defun maven-central.versions-callback (status)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  (let ( (buffer (current-buffer)) json )
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
    (with-temp-buffer
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
      (url-insert buffer)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
      (beginning-of-buffer)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
      (setq json (json-read))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
      ;; (switch-to-buffer maven-central.buffer-name)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
      ;; (pp json)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
      (message "Available versions: %s" (mapconcat (lambda (json) (cdr (assq 'v json))) (cdr (assq 'docs (cdr (assoc 'response json)))) ", "))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
      )))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
(defun maven-central.versions (groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  "Retrieve available versions."
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
  (url-retrieve (maven-central.versions-url groupId artifactId) #'maven-central.versions-callback))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
(defun maven-central.last-version-url (groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  (concat maven-central.search-url "&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
;; (maven-central.versions-url "junit" "junit")
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
(defun maven-central.last-version-callback (status)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  (let ( (buffer (current-buffer)) json )
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
    (with-temp-buffer
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
      (url-insert buffer)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
      (beginning-of-buffer)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
      (setq json (json-read))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
      ;; (switch-to-buffer maven-central.buffer-name)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
      ;; (pp json)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
      (message "Latest version: %s" (cdr (assq 'latestVersion (elt (cdr (assq 'docs (cdr (assoc 'response json)))) 0))))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
      )))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
(defun maven-central.last-version (groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  "Retrieve last package version."
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  (url-retrieve (maven-central.last-version-url groupId artifactId) #'maven-central.last-version-callback))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
(defun maven-central.parse-pom-dependency-in-region (start end)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  (let (groupId artifactId version)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
    (save-restriction
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
      (narrow-to-region start end)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
      (goto-char start)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
      (re-search-forward "<groupId>\\([^<]*\\)</groupId>" nil t)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
      (setq groupId (match-string-no-properties 1))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
      (goto-char start)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
      (re-search-forward "<artifactId>\\([^<]*\\)</artifactId>" nil t)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
      (setq artifactId (match-string-no-properties 1))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
      (goto-char start)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
      (re-search-forward "<version>\\([^<]*\\)</version>" nil t)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
      (setq version (match-string-no-properties 1))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
      (list groupId artifactId version)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
      )))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
(defun maven-central.parse-pom-dependency (&optional point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
  (unless point
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
    (setq point (point)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
  (let (start end pos groupId artifactId version fs-o bs-o fs-c bs-c)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
    (save-excursion
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
      (goto-char point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
      (unless (eq (char-after) ?<)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
        (search-backward "<"))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
      (setq point (point))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
      (setq fs-o (re-search-forward "<\\(?:plugin\\|dependency\\)>" nil t))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
      (when fs-o
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
        (setq fs-o (- fs-o 12)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
      (goto-char point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
      (setq bs-o (re-search-backward "<\\(?:plugin\\|dependency\\)>" nil t))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
      (goto-char point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
      (setq fs-c (re-search-forward "</\\(?:plugin\\|dependency\\)>" nil t))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
      (goto-char point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
      (setq bs-c (re-search-backward "</\\(?:plugin\\|dependency\\)>" nil t))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
      (when bs-c
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
        (setq bs-c (+ bs-c 13)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
      (cond
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
       ((and fs-o (= fs-o point) fs-c)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
        (maven-central.parse-pom-dependency-in-region fs-o fs-c))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
       ((and bs-o (<= bs-o point) fs-c (<= point fs-c))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
        (maven-central.parse-pom-dependency-in-region bs-o fs-c))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
       ((and fs-o fs-c)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
        (maven-central.parse-pom-dependency-in-region fs-o fs-c))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
       ((and bs-o bs-c)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
        (maven-central.parse-pom-dependency-in-region bs-o bs-c))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
       (t
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
        (list nil nil nil)))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
      )))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
(defun maven-central.parse-test (&optional point)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  (interactive)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  (pp (maven-central.parse-pom-dependency)) )
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
;;;###autoload 
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
(defun maven-central.last-version-from-pom ()
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
  (interactive)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
  (let (dependency groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
    (setq dependency (maven-central.parse-pom-dependency))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
    (setq groupId (elt dependency 0))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
    (setq artifactId (elt dependency 1))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
    (when (and groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
      (maven-central.last-version groupId artifactId))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
    ))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
;;;###autoload 
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
(defun maven-central.versions-from-pom ()
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
  (interactive)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
  (let (dependency groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
    (setq dependency (maven-central.parse-pom-dependency))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
    (setq groupId (elt dependency 0))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
    (setq artifactId (elt dependency 1))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
    (when (and groupId artifactId)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
      (maven-central.versions groupId artifactId))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
    ))
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
1108
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   133
(defvar maven.command "mvn")
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   134
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   135
(defvar maven.help-buffer-name "*Maven Help*")
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   136
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   137
(defun maven.help ()
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   138
  "Run help:describe for plugin at point."
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   139
  (interactive)
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   140
  (let (dependency groupId artifactId)
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   141
    (setq dependency (maven-central.parse-pom-dependency))
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   142
    (setq groupId (elt dependency 0))
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   143
    (setq artifactId (elt dependency 1))
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   144
    (if (not (and groupId artifactId))
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   145
        (message "Can't find `groupId' or `artifactId'")
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   146
      (shell-command
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   147
       (format "%s help:describe -DgroupId=%s -DartifactId=%s" maven.command groupId artifactId)
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   148
       (switch-to-buffer maven.help-buffer-name)) )
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   149
    ))
8e730890ac85 maven.help - Run help:describe for plugin at point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1091
diff changeset
   150
1109
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   151
(defun maven.effective-pom ()
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   152
  "Run help:effective-pom for plugin at point."
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   153
  (interactive)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   154
  (shell-command
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   155
   (format "%s help:effective-pom" maven.command)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   156
   (switch-to-buffer maven.help-buffer-name)) )
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   157
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   158
(defun maven.effective-pom ()
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   159
  "Run help:effective-settings for plugin at point."
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   160
  (interactive)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   161
  (shell-command
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   162
   (format "%s help:effective-settings" maven.command)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   163
   (switch-to-buffer maven.help-buffer-name)) )
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   164
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   165
(defun maven.dependency-tree ()
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   166
  "Run dependency:tree for plugin at point."
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   167
  (interactive)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   168
  (shell-command
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   169
   (format "%s dependency:tree" maven.command)
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   170
   (switch-to-buffer maven.help-buffer-name)) )
09d967bff50f help:effective-pom help:effective-settings dependency:tree
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1108
diff changeset
   171
1082
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   172
;; (maven-central.last-version "junit" "junit")
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   173
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   174
(provide 'maven-central)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   175
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   176
(provide 'maven-central)
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   177
964519e5a5ac maven-central helper.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   178
;;; maven-central.el ends here