]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
add mvn and maven-test-mode
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 21 May 2025 13:01:36 +0000 (15:01 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 21 May 2025 13:01:36 +0000 (15:01 +0200)
elpa/maven-test-mode-20141220.557/maven-test-mode-autoloads.el [new file with mode: 0644]
elpa/maven-test-mode-20141220.557/maven-test-mode-pkg.el [new file with mode: 0644]
elpa/maven-test-mode-20141220.557/maven-test-mode.el [new file with mode: 0644]
elpa/mvn-20181002.1617/mvn-autoloads.el [new file with mode: 0644]
elpa/mvn-20181002.1617/mvn-pkg.el [new file with mode: 0644]
elpa/mvn-20181002.1617/mvn.el [new file with mode: 0644]

diff --git a/elpa/maven-test-mode-20141220.557/maven-test-mode-autoloads.el b/elpa/maven-test-mode-20141220.557/maven-test-mode-autoloads.el
new file mode 100644 (file)
index 0000000..d9e1e49
--- /dev/null
@@ -0,0 +1,47 @@
+;;; maven-test-mode-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
+;; Generated by the `loaddefs-generate' function.
+
+;; This file is part of GNU Emacs.
+
+;;; Code:
+
+(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
+
+
+\f
+;;; Generated autoloads from maven-test-mode.el
+
+(defvar maven-test-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c , a") 'maven-test-all) (define-key map (kbd "C-c , v") 'maven-test-file) (define-key map (kbd "C-c , s") 'maven-test-method) (define-key map (kbd "C-c , i") 'maven-test-install) (define-key map (kbd "C-c , C") 'maven-test-clean-test-all) (define-key map (kbd "C-c , r") 'recompile) (define-key map (kbd "C-c , t") 'maven-test-toggle-between-test-and-class) (define-key map (kbd "C-c , y") 'maven-test-toggle-between-test-and-class-other-window) map))
+(autoload 'maven-test-mode "maven-test-mode" "\
+This minor mode provides utilities to run maven test tasks
+
+This is a minor mode.  If called interactively, toggle the `Maven-Test
+mode' mode.  If the prefix argument is positive, enable the mode, and if
+it is zero or negative, disable the mode.
+
+If called from Lisp, toggle the mode if ARG is `toggle'.  Enable the
+mode if ARG is nil, omitted, or is a positive number.  Disable the mode
+if ARG is a negative number.
+
+To check whether the minor mode is enabled in the current buffer,
+evaluate the variable `maven-test-mode'.
+
+The mode's hook is called both when the mode is enabled and when it is
+disabled.
+
+(fn &optional ARG)" t)
+(register-definition-prefixes "maven-test-mode" '("maven-"))
+\f
+;;; End of scraped data
+
+(provide 'maven-test-mode-autoloads)
+
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; no-native-compile: t
+;; coding: utf-8-emacs-unix
+;; End:
+
+;;; maven-test-mode-autoloads.el ends here
diff --git a/elpa/maven-test-mode-20141220.557/maven-test-mode-pkg.el b/elpa/maven-test-mode-20141220.557/maven-test-mode-pkg.el
new file mode 100644 (file)
index 0000000..3e45eaa
--- /dev/null
@@ -0,0 +1,9 @@
+;; -*- no-byte-compile: t; lexical-binding: nil -*-
+(define-package "maven-test-mode" "20141220.557"
+  "Utilities for navigating test files and running maven test tasks."
+  '((s     "1.9")
+    (emacs "24"))
+  :url "http://github.com/rranelli/maven-test-mode"
+  :commit "a19151861df2ad8ae4880a2e7c86ddf848cb569a"
+  :revdesc "a19151861df2"
+  :keywords '("java" "maven" "test"))
diff --git a/elpa/maven-test-mode-20141220.557/maven-test-mode.el b/elpa/maven-test-mode-20141220.557/maven-test-mode.el
new file mode 100644 (file)
index 0000000..6fdeb6c
--- /dev/null
@@ -0,0 +1,289 @@
+;;; maven-test-mode.el --- Utilities for navigating test files and running maven test tasks.
+
+;; Copyright (C) 2014 Renan Ranelli <renanranelli at google mail>
+
+;; Author: Renan Ranelli
+;; URL: http://github.com/rranelli/maven-test-mode
+;; Package-Version: 20141220.557
+;; Package-Revision: a19151861df2
+;; Keywords: java, maven, test
+;; Package-Requires: ((s "1.9") (emacs "24"))
+
+;;; License:
+
+;; This file is NOT part of GNU Emacs.
+;;
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; See <http://www.gnu.org/licenses/> for a copy of the GNU General
+;; Public License.
+
+;;; Commentary:
+
+;; This minor mode provides some enhancements to java-mode in order to use maven
+;; test tasks with little effort. It's largely based on the philosophy of
+;; `rspec-mode' by Peter Williams. Namely, it provides the following
+;; capabilities:
+;;
+;;  * toggle back and forth between a test and it's class (bound to `\C-c ,t`)
+;;
+;;  * verify the test class associated with the current buffer (bound to `\C-c ,v`)
+;;
+;;  * verify the test defined in the current buffer if it is a test file (bound
+;;    to `\C-c ,v`)
+;;
+;;  * verify the test method defined at the point of the current buffer (bound
+;;    to `\C-c ,s`)
+;;
+;;  * re-run the last verification process (bound to `\C-c ,r`)
+;;
+;;  * run tests for entire project (bound to `\C-c ,a`)
+;;
+;; Check the full list of available keybindings at `maven-test-mode-map'
+;;
+;; maven-test-mode defines a derived minor mode `maven-test-compilation' which
+;; allows one to jump from compilation errors to text files.
+;;
+;;; Change Log:
+;;
+;; 0.1.5 - Fixes package description.
+;; 0.1.4 - Minor refactorings.
+;; 0.1.3 - Add ert tests.
+;; 0.1.2 - Add derived mode maven-test-compilation and abolish
+;; maven-test-add-regexps-for-stack-trace-jump
+;; 0.1.1 - Minor changes showing surefire reports on compilation buffer
+;; 0.1 - First release
+
+;;; Code:
+\f
+(require 's)
+(require 'compile)
+
+;;
+;;; Customization
+;;
+(defcustom maven-test-class-to-test-subs
+  '(("/src/main/" . "/src/test/")
+    (".java" . "Test.java"))
+  "Patterns to substitute into class' filename to jump to the associated test."
+  :group 'maven-test)
+
+(defcustom maven-test-test-method-name-regexes
+  '("void\s+\\([a-zA-Z]+\\)\s*()\s*\n?\s*{"    ;; default java method
+    "def \\([a-zA-Z]+\\).*\s*=\s*")            ;; scala method
+  "Pattern to identify the test method name before point. The first match group
+should return the method name."
+  :group 'maven-test)
+
+(defcustom maven-test-is-test-file-regexp
+  "/src/test/"
+  "Regexp that, by matching file path, determines if it is a test file.")
+
+(defcustom maven-test-test-task-options
+  "-q"
+  "Options to add to the test task."
+  :group 'maven-test)
+\f
+;;
+;;; Keybindings
+;;
+;;;###autoload
+(defvar maven-test-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd  "C-c , a") 'maven-test-all)
+    (define-key map (kbd  "C-c , v") 'maven-test-file)
+    (define-key map (kbd  "C-c , s") 'maven-test-method)
+    (define-key map (kbd  "C-c , i") 'maven-test-install)
+    (define-key map (kbd  "C-c , C") 'maven-test-clean-test-all)
+    (define-key map (kbd  "C-c , r") 'recompile)
+    (define-key map (kbd  "C-c , t") 'maven-test-toggle-between-test-and-class)
+    (define-key map (kbd  "C-c , y") 'maven-test-toggle-between-test-and-class-other-window)
+    map))
+\f
+;;; Test functions
+;;
+(defun maven-test-all ()
+  "Run maven test task."
+  (interactive)
+  (maven-test-compile (maven-test-all-command)))
+
+(defun maven-test-install ()
+  "Run maven build task."
+  (interactive)
+  (maven-test-compile (maven-test-format-task "install")))
+
+(defun maven-test-clean-test-all ()
+  "Run maven clean and test task."
+  (interactive)
+  (maven-test-compile (maven-test-format-task "clean test")))
+
+(defun maven-test-file ()
+  "Run maven test task for current file."
+  (interactive)
+  ;; HACK: this cur-file stuff is.
+  (let ((cur-file (buffer-file-name)))
+    (unless (maven-test-is-test-file-p)
+      (maven-test-toggle-between-test-and-class))
+    (maven-test-compile (maven-test-file-command))
+    (find-file cur-file)))
+\f
+;;
+;;; Test commands
+;;
+(defun maven-test-method ()
+  "Run maven test task for current method"
+  (interactive)
+  (unless (maven-test-is-test-file-p)
+    (error "Not visiting test file."))
+  (maven-test-compile (maven-test-method-command)))
+
+(defun maven-test-all-command ()
+  (s-concat
+   (maven-test-format-task (maven-test--test-task))
+   (maven-test-format-show-surefire-reports)))
+
+(defun maven-test-file-command ()
+  (s-concat
+   (maven-test-format-task (maven-test--test-task))
+   (maven-test-class-name-from-buffer)
+   (maven-test-format-show-surefire-reports)))
+
+(defun maven-test-method-command ()
+  (s-concat
+   (maven-test-format-task (maven-test--test-task))
+   (maven-test-class-name-from-buffer)
+   "#"
+   (maven-test-get-prev-test-method-name)
+   (maven-test-format-show-surefire-reports)))
+\f
+;;
+;;; Command formatting
+;;
+(defun maven-test-format-task (task)
+  (format "cd %s && mvn %s" (maven-test-root-dir) task))
+
+(defun maven-test-format-show-surefire-reports ()
+  (format
+   ";EC=$?; if [[ $EC != 0 && -d %starget/surefire-reports/ ]]; then cat %starget/surefire-reports/*.txt; exit $EC; fi"
+   (maven-test-root-dir)
+   (maven-test-root-dir)))
+
+(defun maven-test-class-name-from-buffer ()
+  (format " -Dtest=%s" (file-name-base (buffer-file-name))))
+
+(defun maven-test-get-prev-test-method-name ()
+  (or
+   (maven-test--get-first-match maven-test-test-method-name-regexes)
+   (error "No test method definition before point.")))
+
+(defun maven-test--test-task ()
+  (format "test %s" maven-test-test-task-options))
+
+(defun maven-test--get-first-match (rxs)
+  (when (and rxs (car rxs))
+    (or
+     (and
+      ;; this `and` block exists in order not to let (match-string 1) be
+      ;; evaluated if there was no match for this rx
+      (save-excursion
+       (end-of-line)
+       (re-search-backward (car rxs) nil t))
+      (match-string 1))
+     (maven-test--get-first-match (cdr rxs)))))
+\f
+;;
+;;; Toggle between test and class
+;;
+(defun maven-test-is-test-file-p ()
+  (string-match maven-test-is-test-file-regexp (buffer-file-name)))
+
+(defun maven-test-toggle-between-test-and-class ()
+  (interactive)
+  (maven-test--toggle-between-test-and-class #'find-file))
+
+(defun maven-test-toggle-between-test-and-class-other-window ()
+  (interactive)
+  (maven-test--toggle-between-test-and-class #'find-file-other-window))
+
+(defun maven-test--toggle-between-test-and-class (func)
+  (funcall func (maven-test-toggle-get-target-filename)))
+
+(defun maven-test-toggle-get-target-filename ()
+  "If visiting a Java class file, returns it's associated test filename. If
+visiting a test file, returns it's associated Java class filename"
+  (let* ((subs (if (maven-test-is-test-file-p)
+                  (maven-test-test-to-class-subs)
+                maven-test-class-to-test-subs)))
+    (s-replace-all subs (buffer-file-name))))
+
+(defun maven-test-test-to-class-subs ()
+  "Reverts maven-test-class-to-test-subs."
+  (mapcar
+   #'(lambda (e) `(,(cdr e) . ,(car e)))
+   maven-test-class-to-test-subs))
+\f
+;;
+;;; Compilation mode jumps
+;;
+;; -- the following code was stolen from https://github.com/coreyoconnor/RCs
+(defvar maven-test-java-src-dir "src/main/java/")
+(defvar maven-test-java-tst-dir "src/test/java/")
+
+(defun maven-test-java-src-stack-trace-regexp-to-filename ()
+  "Generates a relative filename from java-stack-trace regexp match data."
+  (maven-test--java-stack-trace-regexp-to-filename maven-test-java-src-dir))
+
+(defun maven-test-java-tst-stack-trace-regexp-to-filename ()
+  "Generates a relative filename from java-stack-trace regexp match data."
+  (maven-test--java-stack-trace-regexp-to-filename maven-test-java-tst-dir))
+
+(defun maven-test--java-stack-trace-regexp-to-filename (root)
+  (concat root
+         (replace-regexp-in-string "\\." "/" (match-string 1))
+         (match-string 2)))
+\f
+;;
+;;; Utilities
+;;
+(defun maven-test-root-dir ()
+  "Locates maven root directory."
+  (expand-file-name (locate-dominating-file (buffer-file-name) "pom.xml")))
+
+(defun maven-test-compile (command)
+  (compile command 'maven-compilation-mode))
+
+(define-derived-mode maven-compilation-mode compilation-mode "Maven Test Compilation"
+  "Compilation mode for Maven output."
+  (set (make-local-variable 'compilation-error-regexp-alist)
+       (append '(java-tst-stack-trace java-src-stack-trace)
+              compilation-error-regexp-alist))
+
+  (set (make-local-variable 'compilation-error-regexp-alist-alist)
+       (append '((java-tst-stack-trace
+                 "at \\(\\(?:[[:alnum:]]+\\.\\)+\\)+[[:alnum:]]+\\.[[:alnum:]]+(\\([[:alnum:]]+\\Test.java\\):\\([[:digit:]]+\\))$"
+                 maven-test-java-tst-stack-trace-regexp-to-filename 3)
+                 (java-src-stack-trace
+                 "at \\(\\(?:[[:alnum:]]+\\.\\)+\\)+[[:alnum:]]+\\.[[:alnum:]]+(\\([[:alnum:]]+\\.java\\):\\([[:digit:]]+\\))$"
+                 maven-test-java-src-stack-trace-regexp-to-filename 3))
+               compilation-error-regexp-alist-alist)))
+
+;;;###autoload
+(define-minor-mode maven-test-mode
+  "This minor mode provides utilities to run maven test tasks"
+  :init-value nil
+  :keymap maven-test-mode-map
+  :lighter " MvnTest"
+  :group 'maven-test)
+
+(add-hook 'java-mode-hook 'maven-test-mode)
+
+(provide 'maven-test-mode)
+;;; maven-test-mode.el ends here
diff --git a/elpa/mvn-20181002.1617/mvn-autoloads.el b/elpa/mvn-20181002.1617/mvn-autoloads.el
new file mode 100644 (file)
index 0000000..f817cef
--- /dev/null
@@ -0,0 +1,41 @@
+;;; mvn-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
+;; Generated by the `loaddefs-generate' function.
+
+;; This file is part of GNU Emacs.
+
+;;; Code:
+
+(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
+
+
+\f
+;;; Generated autoloads from mvn.el
+
+(autoload 'mvn-kill-cache "mvn" nil t)
+(autoload 'mvn "mvn" "\
+Run mvn `task` in project root directory.
+
+(fn &optional TASK ARGS)" t)
+(autoload 'mvn-last "mvn" "\
+Run the last maven task in project" t)
+(autoload 'mvn-compile "mvn" nil t)
+(autoload 'mvn-clean "mvn" nil t)
+(autoload 'mvn-test "mvn" "\
+
+
+(fn PREFIX)" t)
+(register-definition-prefixes "mvn" '("mvn-"))
+\f
+;;; End of scraped data
+
+(provide 'mvn-autoloads)
+
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; no-native-compile: t
+;; coding: utf-8-emacs-unix
+;; End:
+
+;;; mvn-autoloads.el ends here
diff --git a/elpa/mvn-20181002.1617/mvn-pkg.el b/elpa/mvn-20181002.1617/mvn-pkg.el
new file mode 100644 (file)
index 0000000..50c3721
--- /dev/null
@@ -0,0 +1,10 @@
+;; -*- no-byte-compile: t; lexical-binding: nil -*-
+(define-package "mvn" "20181002.1617"
+  "Helpers for compiling with maven."
+  ()
+  :url "https://github.com/apgwoz/mvn-el"
+  :commit "ffa40235b7dabb6c6c165f64f32a963cde8031f0"
+  :revdesc "ffa40235b7da"
+  :keywords '("compilation" "maven" "java")
+  :authors '(("Andrew Gwozdziewycz" . "gitNOSPAMapgwoz.com"))
+  :maintainers '(("Andrew Gwozdziewycz" . "gitNOSPAMapgwoz.com")))
diff --git a/elpa/mvn-20181002.1617/mvn.el b/elpa/mvn-20181002.1617/mvn.el
new file mode 100644 (file)
index 0000000..78d6362
--- /dev/null
@@ -0,0 +1,524 @@
+;;; mvn.el --- helpers for compiling with maven
+
+;; Copyright (C) 2013 Andrew Gwozdziewycz <gitNOSPAMapgwoz.com>
+
+;; Author: Andrew Gwozdziewycz <gitNOSPAMapgwoz.com>
+;; URL : https://github.com/apgwoz/mvn-el
+;; Package-Version: 20181002.1617
+;; Package-Revision: ffa40235b7da
+;; Keywords: compilation, maven, java
+
+;; This file is NOT part of GNU Emacs
+
+;; This is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 3, or (at your option) any later
+;; version.
+
+;; This is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+(defvar mvn-last-task "compile")
+(defvar mvn-build-file-name "pom.xml")
+(defvar mvn-command "mvn")
+
+(defvar mvn-task-history nil
+  "History list of read task(s)")
+
+(defvar mvn-default-phases '("validate"
+                             "initialize"
+                             "generate-sources"
+                             "process-sources"
+                             "generate-resources"
+                             "process-resources"
+                             "compile"
+                             "process-classes"
+                             "generate-test-sources"
+                             "process-test-sources"
+                             "generate-test-resources"
+                             "process-test-resources"
+                             "test-compile"
+                             "process-test-classes"
+                             "test"
+                             "package"
+                             "pre-integration-test"
+                             "integration-test"
+                             "post-integration-test"
+                             "verify"
+                             "install"
+                             "deploy")
+  "phases for the default lifecycle")
+
+(defvar mvn-clean-phases '("pre-clean"
+                           "clean"
+                           "post-clean")
+  "phases for the clean lifecycle")
+
+(defvar mvn-site-phases '("pre-site"
+                          "site"
+                          "post-site"
+                          "site-deploy")
+  "phases for the site lifecycle")
+
+(defvar mvn-core-plugins '("clean:clean"
+                           "clean:help"
+                           "compiler:compile"
+                           "compiler:testCompile"
+                           "compiler:help"
+                           "deploy:deploy"
+                           "deploy:deploy-file"
+                           "deploy:help"
+                           "install:install"
+                           "install:install-file"
+                           "install:help"
+                           "resources:resources"
+                           "resources:testResources"
+                           "resources:copy-resources"
+                           "resources:help"
+                           "site:site"
+                           "site:deploy"
+                           "site:run"
+                           "site:stage"
+                           "site:stage-deploy"
+                           "site:attach-descriptor"
+                           "site:jar"
+                           "site:help"
+                           "surefire:test"
+                           "surefire:help"
+                           "verifier:verify"
+                           "verifier:help")
+  "core plugin targets")
+
+
+(defvar mvn-packaging-plugins '("ear:ear"
+                                "ear:generate-application-xml"
+                                "ear:help"
+                                "jar:jar"
+                                "jar:test-jar"
+                                "jar:sign"
+                                "jar:sign-verify"
+                                "jar:help"
+                                "rar:rar"
+                                "rar:help"
+                                "war:war"
+                                "war:exploded"
+                                "war:inplace"
+                                "war:manifest"
+                                "war:help"
+                                "shade:shade"
+                                "shade:help")
+  "packaging plugin targets")
+
+
+(defvar mvn-reporting-plugins '("changelog:changelog"
+                                "changelog:dev-activity"
+                                "changelog:file-activity"
+                                "changelog:help"
+                                "changes:announcement-mail"
+                                "changes:announcement-generate"
+                                "changes:changes-report"
+                                "changes:jira-report"
+                                "changes:changes-validate"
+                                "changes:help"
+                                "checkstyle:checkstyle"
+                                "checkstyle:check"
+                                "checkstyle:help"
+                                "doap:generate"
+                                "doap:help"
+                                "docck:check"
+                                "docck:help"
+                                "javadoc:javadoc"
+                                "javadoc:test-javadoc"
+                                "javadoc:aggregate"
+                                "javadoc:test-aggregate"
+                                "javadoc:jar"
+                                "javadoc:test-jar"
+                                "javadoc:help"
+                                "jxr:jxr"
+                                "jxr:test-jxr"
+                                "jxr:help"
+                                "pmd:pmd"
+                                "pmd:cpd"
+                                "pmd:check"
+                                "pmd:cpd-check"
+                                "pmd:help"
+                                "project-info-reports:cim"
+                                "project-info-reports:dependencies"
+                                "project-info-reports:dependency-convergence"
+                                "project-info-reports:dependency-management"
+                                "project-info-reports:index"
+                                "project-info-reports:issue-tracking"
+                                "project-info-reports:license"
+                                "project-info-reports:mailing-list"
+                                "project-info-reports:plugin-management"
+                                "project-info-reports:project-team"
+                                "project-info-reports:scm"
+                                "project-info-reports:summary"
+                                "project-info-reports:help"
+                                "surefire-report:report"
+                                "surefire-report:report-only"
+                                "surefire-report:help")
+  "reporting plugin targets")
+
+(defvar mvn-tools-plugins '("ant:ant"
+                            "ant:clean"
+                            "ant:help"
+                            "antrun:run"
+                            "antrun:help"
+                            "archetype:create"
+                            "archetype:generate"
+                            "archetype:create-from-project"
+                            "archetype:crawl"
+                            "archetype:help"
+                            "assembly:assembly"
+                            "assembly:directory"
+                            "assembly:directory-single"
+                            "assembly:single"
+                            "assembly:help"
+                            "dependency:copy"
+                            "dependency:copy-dependencies"
+                            "dependency:unpack"
+                            "dependency:unpack-dependencies"
+                            "dependency:resolve"
+                            "dependency:list"
+                            "dependency:sources"
+                            "dependency:resolve-plugins"
+                            "dependency:go-offline"
+                            "dependency:purge-local-repository"
+                            "dependency:build-classpath"
+                            "dependency:analyze"
+                            "dependency:analyze-dep-mgt"
+                            "dependency:tree"
+                            "dependency:help"
+                            "enforcer:enforce"
+                            "enforcer:display-info"
+                            "enforcer:help"
+                            "gpg:sign"
+                            "gpg:sign-and-deploy-file"
+                            "gpg:help"
+                            "help:active-profiles"
+                            "help:all-profiles"
+                            "help:describe"
+                            "help:effective-pom"
+                            "help:effective-settings"
+                            "help:evaluate"
+                            "help:expressions"
+                            "help:system"
+                            "invoker:install"
+                            "invoker:run"
+                            "invoker:help"
+                            "one:convert"
+                            "one:deploy-maven-one-repository"
+                            "one:install-maven-one-repository"
+                            "one:maven-one-plugin"
+                            "one:help"
+                            "patch:apply"
+                            "patch:help"
+                            "pdf:pdf"
+                            "pdf:help"
+                            "plugin:descriptor"
+                            "plugin:report"
+                            "plugin:updateRegistry"
+                            "plugin:xdoc"
+                            "plugin:addPluginArtifactMetadata"
+                            "plugin:helpmojo"
+                            "plugin:help"
+                            "release:clean"
+                            "release:prepare"
+                            "release:rollback"
+                            "release:perform"
+                            "release:stage"
+                            "release:branch"
+                            "release:help"
+                            "reactor:resume"
+                            "reactor:make"
+                            "reactor:make-dependents"
+                            "reactor:make-scm-changes"
+                            "reactor:help"
+                            "remote-resources:bundle"
+                            "remote-resources:process"
+                            "remote-resources:help"
+                            "repository:bundle-create"
+                            "repository:bundle-pack"
+                            "repository:help"
+                            "scm:branch"
+                            "scm:validate"
+                            "scm:add"
+                            "scm:unedit"
+                            "scm:export"
+                            "scm:bootstrap"
+                            "scm:changelog"
+                            "scm:list"
+                            "scm:checkin"
+                            "scm:checkout"
+                            "scm:status"
+                            "scm:update"
+                            "scm:diff"
+                            "scm:update-subprojects"
+                            "scm:edit"
+                            "scm:tag"
+                            "scm:help"
+                            "source:aggregate"
+                            "source:jar"
+                            "source:test-jar"
+                            "source:jar-no-fork"
+                            "source:test-jar-no-fork"
+                            "source:help"
+                            "stage:copy"
+                            "stage:help")
+  "tools plugin targets")
+
+(defvar mvn-ide-plugins '("eclipse:clean"
+                          "eclipse:configure-workspace"
+                          "eclipse:eclipse"
+                          "eclipse:help"
+                          "eclipse:install-plugins"
+                          "eclipse:m2eclipse"
+                          "eclipse:make-artifacts"
+                          "eclipse:myeclipse"
+                          "eclipse:myeclipse-clean"
+                          "eclipse:rad"
+                          "eclipse:rad-clean"
+                          "eclipse:remove-cache"
+                          "eclipse:to-maven"
+                          "idea:clean"
+                          "idea:help"
+                          "idea:idea"
+                          "idea:module"
+                          "idea:project"
+                          "idea:workspace")
+  "IDE plugin targets")
+
+(defvar mvn-other-plugins '("plexus:app"
+                            "plexus:bundle-application"
+                            "plexus:bundle-runtime"
+                            "plexus:descriptor"
+                            "plexus:runtime"
+                            "plexus:service"
+                            "jetty:run-war"
+                            "jetty:run"
+                            "cargo:start"
+                            "cargo:stop"
+                            "dbunit:export"
+                            "dbunit:operation"
+                            "exec:exec"
+                            "exec:java"
+                            "exec:help"
+                            "hibernate3:hbm2cfgxml"
+                            "hibernate3:hbm2ddl"
+                            "hibernate3:hbm2doc"
+                            "hibernate3:hbm2hbmxml"
+                            "hibernate3:hbm2java"
+                            "hibernate3:schema-export"
+                            "hibernate3:schema-update"
+                            "groovy:compile"
+                            "groovy:console"
+                            "groovy:execute"
+                            "groovy:generateStubs"
+                            "groovy:generateTestStubs"
+                            "groovy:help"
+                            "groovy:providers"
+                            "groovy:shell"
+                            "groovy:testCompile"
+                            "gwt:compile"
+                            "gwt:eclipse"
+                            "gwt:eclipseTest"
+                            "gwt:generateAsync"
+                            "gwt:help"
+                            "gwt:i18n"
+                            "gwt:test"
+                            "javacc:help"
+                            "javacc:javacc"
+                            "javacc:jjdoc"
+                            "javacc:jjtree"
+                            "javacc:jjtree-javacc"
+                            "javacc:jtb"
+                            "javacc:jtb-javacc"
+                            "jboss:configure"
+                            "jboss:deploy"
+                            "jboss:harddeploy"
+                            "jboss:start"
+                            "jboss:stop"
+                            "jboss:undeploy"
+                            "jboss-packaging:esb"
+                            "jboss-packaging:esb-exploded"
+                            "jboss-packaging:har"
+                            "jboss-packaging:har-exploded"
+                            "jboss-packaging:sar"
+                            "jboss-packaging:sar-exploded"
+                            "jboss-packaging:sar-inplace"
+                            "jboss-packaging:spring"
+                            "jpox:enhance"
+                            "jpox:schema-create"
+                            "jpox:schema-dbinfo"
+                            "jpox:schema-delete"
+                            "jpox:schema-info"
+                            "jpox:schema-validate"
+                            "make:autoreconf"
+                            "make:chmod"
+                            "make:chown"
+                            "make:compile"
+                            "make:configure"
+                            "make:help"
+                            "make:make-clean"
+                            "make:make-dist"
+                            "make:make-install"
+                            "make:test"
+                            "make:validate-pom"
+                            "nbm:autoupdate"
+                            "nbm:branding"
+                            "nbm:cluster"
+                            "nbm:directory"
+                            "nbm:jar"
+                            "nbm:nbm"
+                            "nbm:populate-repository"
+                            "nbm:run-ide"
+                            "nbm:run-platform"
+                            "spring-boot:help"
+                            "spring-boot:repackage"
+                            "spring-boot:run"
+                            "tomcat:deploy"
+                            "tomcat:exploded"
+                            "tomcat:info"
+                            "tomcat:inplace"
+                            "tomcat:list"
+                            "tomcat:redeploy"
+                            "tomcat:resources"
+                            "tomcat:roles"
+                            "tomcat:run"
+                            "tomcat:run-war"
+                            "tomcat:sessions"
+                            "tomcat:start"
+                            "tomcat:stop"
+                            "tomcat:undeploy"
+                            "wagon:copy"
+                            "wagon:download"
+                            "wagon:download-single"
+                            "wagon:help"
+                            "wagon:list"
+                            "wagon:merge-maven-repos"
+                            "wagon:upload"
+                            "wagon:upload-single"
+                            "was6:clean"
+                            "was6:ejbdeploy"
+                            "was6:help"
+                            "was6:installApp"
+                            "was6:wsAdmin"
+                            "was6:wsDefaultBindings"
+                            "was6:wsListApps"
+                            "was6:wsStartApp"
+                            "was6:wsStartServer"
+                            "was6:wsStopApp"
+                            "was6:wsStopServer"
+                            "was6:wsUninstallApp"
+                            "weblogic:appc"
+                            "weblogic:clientgen"
+                            "weblogic:clientgen9"
+                            "weblogic:deploy"
+                            "weblogic:jwsc"
+                            "weblogic:listapps"
+                            "weblogic:redeploy"
+                            "weblogic:servicegen"
+                            "weblogic:start"
+                            "weblogic:stop"
+                            "weblogic:undeploy"
+                            "weblogic:wsdlgen")
+  "Other plugins")
+
+(defvar mvn-plugins-and-goals (append
+                               mvn-default-phases
+                               mvn-clean-phases
+                               mvn-site-phases
+                               mvn-core-plugins
+                               mvn-packaging-plugins
+                               mvn-reporting-plugins
+                               mvn-tools-plugins
+                               mvn-ide-plugins
+                               mvn-other-plugins)
+  "List of all plugins and goals")
+
+;;(defalias 'mvn-tasks-default 'maven-plugins-and-goals)
+;; (defvar mvn-tasks-default '("compile" "test" "clean"))
+
+(defun mvn-find-tasks (directory)
+  (let ((output (shell-command-to-string (concat *mvn-tasks-command* " "
+                                                 directory "/"
+                                                 mvn-build-file-name))))
+    (message output)
+    (if (> (length output) 0)
+        (mapcar (lambda (x) (replace-regexp-in-string ".*<target.*name=\"\\([^\-][^\"]*\\).*" "\\1" x))
+                (split-string output "[\n]"))
+      nil)))
+
+;; should cache tasks from the build file at some point
+(defun mvn-tasks (directory)
+  (let ((tasks (assoc-string directory *mvn-tasks-cache*)))
+    (cdr
+     (or tasks
+         (progn
+           (let ((newtasks (or (mvn-find-tasks directory) mvn-plugins-and-goals)))
+             (setq *mvn-tasks-cache*
+                   (cons (cons directory newtasks) *mvn-tasks-cache*))
+             newtasks))))))
+
+(defun mvn-get-task (directory)
+  (let ((task (completing-read-multiple (concat "Goal (default): ")
+                                        mvn-plugins-and-goals nil
+                                        nil nil 'mvn-task-history)))
+    (if (> (length task) 0)
+        (mapconcat 'identity task " ")
+      "")))
+
+(defun mvn-find-root (indicator)
+  (let ((cwd default-directory))
+    (locate-dominating-file cwd mvn-build-file-name)))
+
+;;;###autoload
+(defun mvn-kill-cache ()
+  (interactive)
+  (setq *mvn-tasks-cache* '()))
+
+;;;###autoload
+(defun mvn (&optional task args)
+  "Run mvn `task` in project root directory."
+  (interactive)
+  (let ((default-directory (mvn-find-root mvn-build-file-name)))
+    (if default-directory
+        (let ((task (or task (mvn-get-task default-directory))))
+          (setq mvn-last-task task)
+          (compile (concat mvn-command " " task " " args)))
+      (message "Couldn't find a maven project."))))
+
+;;;###autoload
+(defun mvn-last ()
+  "Run the last maven task in project"
+  (interactive)
+  (mvn (or mvn-last-task "")))
+
+;;;###autoload
+(defun mvn-compile ()
+  (interactive)
+  (mvn "compile"))
+
+;;;###autoload
+(defun mvn-clean ()
+  (interactive)
+  (mvn "clean"))
+
+;;;###autoload
+(defun mvn-test (prefix)
+  (interactive "MTest: ")
+  (if prefix
+      (mvn "test" (concat "-Dtest=" prefix))
+    (mvn "test")))
+
+(provide 'mvn)
+
+;;; mvn.el ends here