• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mikelue/vim-maven-plugin: The Maven plugin for VIM

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mikelue/vim-maven-plugin

开源软件地址(OpenSource Url):

https://github.com/mikelue/vim-maven-plugin

开源编程语言(OpenSource Language):

Vim Script 100.0%

开源软件介绍(OpenSource Introduction):

vim-maven-plugin

This plugin provides convenient functions to Apache Maven project.

See doc/maven.txt for example of mappings.

Limitations

  • This plugin wouldn't read the content of pom.xml to setup the context of Maven project. So you should setup directories of source code in your project by default.

Main features:

  1. Detects your editing file if it is under Maven's project(by looking for pom.xml)
  2. Executes Maven as compiler with supporting of quickfix
  3. Jump files between source/test code
  4. Functions for retrieving maven path in current editing buffer

Installation:

VimPlugin(Recommended)

Put following configuration to your vim-plug block of vimrc:

Plug 'mikelue/vim-maven-plugin'

Restart VIM and execute :PlugInstall

Vundle

Put following configuration to your vundle block of vimrc:

Plugin 'mikelue/vim-maven-plugin'

Restart VIM and execute :PluginInstall

Please check out the documentations of your favorite plugin.

Manually

Get the source and copy the source into your runtime path of VIM. Then type helptags ~/vimfiles/doc/ to build tags of help file.

Use help maven.txt to open the help of this plugin.

Brief

Project environment

  • Setting of 'path' option of VIM automatically, to make :find, :sfind working in your src/.
  • Auto-appending options for Maven by buffer-scoped: b:maven_cli_options.
  • Controlling changing working directory automatically by g:maven_auto_chdir.

Command mode

By :Mvn <command>, you can execute Maven command and open quickfix-window.

e.g.,

  • :Mvn compile Execute the 'compile' phase of Maven
  • :Mvn! compile Execute the 'compile' phase of Maven with opening shell window

Mappings

  • With <Plug>MavenRunUnittest, you can set-up your own shortcut to run test of current file.
  • With <Plugn>MavenSwitchUnittestFile, you can set-up your own shortcut to switch files between main/java/Something.java and src/main/java/SomethingTest.java.
  • Theses mappings are supported in normal mode and insertion mode.

See "1.7. Suggestions of keystrokes" of doc/maven.txt for example of mappings.

APIs(VIM functions)

  • With maven#getMavenProjectRoot(buf), you can get the root directory(by looking for pom.xml) of current file.
  • With maven#getListOfPaths(buf), you can get list of /src/main/java, src/test/java, etc., to get search paths of source.
  • With maven#getCandidateClassNameOfTest(className), you can get candidate class name for tests.
    • e.g. Converts Something a list of names: ["SomethingTest", "SomethingTestCase", "SomethingIT", "TestSomething"]

Quckfix window

With setting of 'errorformat', quickfix can show some kinds of errors output by Maven provided by this plugin.

  • Error of POM.xml:
     The project idv.mikelue:sandbox-java:1.0-SNAPSHOT (D:\Code\sandbox-java\pom.xml) has 1 error
     sandbox-java/pom.xml|10 col 8 error| Unrecognised tag: 'data' (position: START_TAG seen ...</parent>\r\n\r\n\t<data>... @10:8)
    
  • Failure of Unit Test(JUnit or TestNG): >
     -------------------------------------------------------
      T E S T S
     -------------------------------------------------------
     Running idv.mikelue.RegionAndInheritancePerformanceTest
     Configuring TestNG with: TestNG652Configurator
     Tests run: 13, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.656 sec <<< FAILURE!
     	src/test/java/idv/mikelue/RegionAndInheritancePerformanceTest.java|\<do1\>|  expected [3] but found [1]    at org.testng.Assert.fail(Assert.java:94)
          at org.testng.Assert.failNotEquals(Assert.java:494)
          at org.testng.Assert.assertEquals(Assert.java:123)
          at org.testng.Assert.assertEquals(Assert.java:370)
          at org.testng.Assert.assertEquals(Assert.java:380)
          at idv.mikelue.RegionAndInheritancePerformanceTest.do1(RegionAndInheritancePerformanceTest.java:25)
    

So that you can set-up your own by CompilerSet errorformat=.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
leechenxiang/maven-spring-websocket-01: spring websocket chating room发布时间:2022-08-17
下一篇:
grails/grails-maven-archetype发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap