Skip to main content
Back to Extensions Directory
coc.nvim fallback icon

coc-maven

asmodeus812

Coc extensions for maven

Installation CommandVim prompt
:CocInstall coc-maven
GitHub owner
asmodeus812
Version
v0.1.9
npm package
coc-maven
Requirements
coc ^0.0.82
License
MIT
Repository
GitHub
npm latest published 2026-11-21Registry summary

Published Package Summary

coc-maven

Maven support for coc.nvim: a project explorer, commands that run goals, lifecycle phases and favorite command lines, completion, hover, go-to-definition, code actions and conflict diagnostics for pom.xml, dependency commands, project and module creation from archetypes, and a search for the artifact behind an unresolved Java type.

This README covers installation, setup and configuration. Every command and feature is described in the help page, available once the extension is active, without :helptags:

:help coc-maven

Requirements

  • Neovim or Vim with coc.nvim 0.0.82 or later.
  • Maven: mvn in $PATH, a Maven wrapper (mvnw, mvnw.cmd) in the project, or an executable that maven.executable.path points to.
  • A JDK that Maven can find through JAVA_HOME.
  • Optional: coc-java (or coc-java-dev). It provides the artifact index for completion and the artifact searcher, and reloads and imports the Java projects. The artifact index only works when the language server runs in standard mode.
  • Optional: coc-xml. When it is active, the extension leaves out its own schema completion and schema hover for pom.xml.
  • Network access to search.maven.org and repo1.maven.org for the artifact and version search, and to repo.maven.apache.org to update the archetype catalog.

Installation

Install the extension from its repository:

:CocInstall https://github.com/asmodeus812/coc-maven

The extension starts when you open a Java file or a workspace that contains a pom.xml in its root or one folder below.

Setup

The filetype of pom.xml

The pom features need the filetype xml for pom.xml. If your Vim setup gives it another filetype, map it:

vim.g.coc_filetype_map = {
    ['pom.xml'] = 'xml',
}

JAVA_HOME

Maven needs JAVA_HOME. Set it in the environment that starts Neovim, or give it to the extension with maven.terminal.customEnv (see Terminal and environment):

{
    "maven.terminal.customEnv": [
        {
            "environmentVariable": "JAVA_HOME",
            "value": "/usr/lib/jvm/java-21-openjdk"
        },
        {
            "environmentVariable": "MAVEN_OPTS",
            "value": "-Xms1024m -Xmx4096m"
        }
    ]
}

On Windows, escape backslashes in the value: "C:\\Program Files\\Java\\jdk-21".

Files

The extension writes:

  • the files Maven generates for a project, in maven.outputDirectory; see Generated files;
  • the command history of each pom, in the coc storage folder of the extension;
  • the archetype catalog, when you update it, in the coc storage folder of the extension (:help coc-maven-archetype);
  • a copy of the artifact index for the artifact searcher, in the coc storage folder of the extension;
  • a copy of the help page and its tags, in the coc storage folder of the extension, which it adds to 'runtimepath'.

It edits your poms only through the dependency, module and project commands.

Troubleshooting

  • "Maven not found in PATH": install Maven or a wrapper, or set maven.executable.path; see Maven executable for the lookup order.
  • Completion, hover and definition do nothing in a pom: check :set filetype? in the pom buffer. It must be xml; see The filetype of pom.xml.
  • No groupId or artifactId candidates: Maven Central needs network access and maven.completion.gavEnabled on, and the Java language server index needs coc-java in standard mode.
  • The explorer is empty: no pom.xml was found; check maven.excludedFolders and maven.pomfile.globPattern.
  • Maven fails: open its output with :CocCommand workspace.showOutput maven. The channel shows each background command line, the JAVA_HOME set in maven.terminal.customEnv, and the local repository.

Development

npm install        # installs the dependencies and builds lib/index.js
npm run build      # builds lib/index.js with esbuild
npm run watch      # rebuilds on change
make update        # rebuilds server/com.microsoft.java.maven.plugin.jar

NODE_ENV=production minifies the bundle, NODE_ENV=development writes a source map. make update builds the Java language server plugin from microsoft/vscode-maven; it needs git, a JDK and Maven.

To try a checkout, add the folder to 'runtimepath', for example set runtimepath^=/path/to/coc-maven, after building it.

License

MIT, see LICENSE. coc-maven is a fork of vscode-maven by Microsoft, adapted to coc.nvim.

Read the complete README
  • Coc extensions for maven
Activation Events
  • onLanguage:java
  • workspaceContains:pom.xml
  • workspaceContains:*/pom.xml
Developer Resources

Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.

Open Developer Guide

Version History

This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.