VSCode extension "Maven for Java"
Перейти к файлу
Yan Zhang 530ef7d4ed
add history entry in context menu (#61)
* add history entry in context menu

* update changelog

* update image in README
2018-06-05 12:50:13 +08:00
.vscode generated by yo 2017-11-10 13:30:04 +08:00
images add history entry in context menu (#61) 2018-06-05 12:50:13 +08:00
resources record steps and selected archetype (#21) 2018-03-08 10:48:31 +08:00
src add history entry in context menu (#61) 2018-06-05 12:50:13 +08:00
.gitignore Better maven archetype experience (#35) 2017-12-14 16:59:10 +08:00
.travis.yml fix travis 2017-12-06 12:09:21 +08:00
.vscodeignore ignore images folder, shrink extension size 2017-12-04 15:53:27 +08:00
CHANGELOG.md add history entry in context menu (#61) 2018-06-05 12:50:13 +08:00
LICENSE.txt Update LICENSE.txt 2018-02-11 09:55:26 +08:00
README.md update readme file (#53) 2018-05-14 13:20:59 +08:00
package-lock.json add history entry in context menu (#61) 2018-06-05 12:50:13 +08:00
package.json add history entry in context menu (#61) 2018-06-05 12:50:13 +08:00
thirdpartynotice.txt add 3rd party notice (#3) 2018-01-16 10:39:36 +08:00
tsconfig.json Better maven archetype experience (#35) 2017-12-14 16:59:10 +08:00
tslint.json format CWD for WSL Bash (#58) 2018-05-23 11:07:19 +08:00

README.md

Maven for Java

Marketplace Version Installs Rating Build Status

Features

Maven extension for VS Code. It now reads pom.xml in root folder, and provide project structures in sidebar, improving user experience for Java developers who use Maven.

  • Effective POM
  • Shortcut to common goals, namely clean, validate, compile, test, package, verify, install, site, deploy.
  • Perserve history of goals to fast re-run long commands(e.g. mvn clean package -DskipTests -Dcheckstyle.skip).
  • Can generate projects from Maven Archetype.
  • Support multi-module maven projects.
  • Support VSCode multi-root workspace.

Requirements

Provide Maven executable filepath.

  • By default, mvn command is executed directly in the terminal, which requires mvn can be found in system envronment PATH.
  • If you do not want to add it into PATH, you can specify maven executable path in settings:
    {
        "maven.executable.path": "/some-path-to-maven-home/bin/mvn"
    }
    

Usage

  • The extension scans pom.xml from each root folder in your workspace recursively, and display all maven projects and their modules in the sidebar.

    Screenshot

  • To speed up the searching of maven projects, you can exclude folders in settings:

    {
        "maven.projects.excludedFolders": [
            "**/.*",                // exclude hidden folders
            "**/node_modules",      // exclude node modules to speed up
            "**/target"             // exclude duplicated pom file in target folder
        ]
    }
    
  • It perserves history of goals for each project, so you can fast re-run previous long commands, e.g. mvn <goals> -Dparam1=value1 -Dparam2=value2 -Dparam3=value3 ...

    Screenshot

  • Archetype Related

    • Generate from Maven Archetype The extension loads archetypes listed in local/remote catelog. After selection, the extension fires mvn archetype:generate -D... in terminal.

    Screenshot

Additional Configurations

JAVA_HOME and Other Environment Variables

This extension executes Maven by opening a terminal session and then calling Maven in that session. Maven requires the JAVA_HOME environment variable to be set. Maven will also look for other variables such as MAVEN_OPTS. If you prefer not to set those variables permanently you can configure them, or any other environment variable, in settings:

{
    "maven.terminal.customEnv": [
        {
            "environmentVariable": "MAVEN_OPTS",               // variable name
            "value": "-Xms1024m -Xmx4096m"                     // value
        },
        {
            "environmentVariable": "JAVA_HOME",                // variable name
            "value": "C:\\Program Files\\Java\\jdk-9.0.4"      // value
        }
    ]
}

Special Handling for JAVA_HOME

If you have Red Hat's Java Language Support extension installed, then you can specify JAVA_HOME in settings for that extension:

{
    "java.home": "C:\\Program Files\\Java\\jdk-9.0.4"      // Red Hat Java Language Support Setting
}

This extension (Maven for Java) can reuse that setting if you desire:

{
    "maven.terminal.useJavaHome": true      // Use the Red Hat Java Language Support Setting for JAVA_HOME
}

With this support, you can specify JAVA_HOME in one place and you do not need to use the maven.terminal.customEnv setting unless you have other environment variables to set.

If you have JAVA_HOME configured through the maven.terminal.customEnv setting, and also specify to reuse the Red Hat setting, then the value from maven.terminal.customEnv will take precedence.

Default Options for Maven Command

The usage of maven executable is:

usage: mvn [options] [<goal(s)>] [<phase(s)>]

You can use maven.executable.options to specify default options for all your maven commands executed in current project.

{
    "maven.executable.options": "-o -s ./settings.xml"      // work offline, and use an alternative settings file 
}

Data/Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you dont wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Release Notes

Refer to CHANGELOG