Wayback Machine
94 captures
16 Apr 2020 - 04 Jun 2025
Jul AUG Oct
Previous capture 03 Next capture
2020 2021 2022
success
fail
About this capture
COLLECTED BY
Collection: Common Crawl
Web crawl data from Common Crawl.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20210803233638/https://code.visualstudio.com/docs/java/java-build
Skip to content  Visual Studio Code
  • Docs
  • Updates
  • Blog
  • API
  • Extensions
  • FAQ
  • Learn
  • Search
  • Search Search
  • Download VS Code Download VS Code Download

Version 1.58 is now available! Read about the new features and fixes from June.

Dismiss this update
'; document.body.appendChild(div.children[0]); } function pushCodingPackEvent(language, os) { let id = `${language}-${os}-coding-pack`; var analytics = window.vscodeAnalytics; analytics && analytics.event( 'click', 'download', id, ); }
  • Overview
  • Setup
    • Overview
    • Linux
    • macOS
    • Windows
    • Raspberry Pi
    • Network
    • Additional Components
  • Get Started
    • Intro Videos
    • Tips and Tricks
    • User Interface
    • Themes
    • Settings
    • Key Bindings
    • Display Language
    • Telemetry
  • User Guide
    • Basic Editing
    • Extension Marketplace
    • IntelliSense
    • Code Navigation
    • Refactoring
    • Debugging
    • Version Control
    • Working with GitHub
    • Integrated Terminal
    • Tasks
    • Settings Sync
    • Snippets
    • Emmet
    • Command Line
    • Workspace Trust
    • Multi-root Workspaces
    • Accessibility
  • Languages
    • Overview
    • JavaScript
    • JSON
    • HTML
    • CSS, SCSS and Less
    • TypeScript
    • Markdown
    • PowerShell
    • C++
    • Java
    • PHP
    • Python
    • Go
    • T-SQL
    • C#
    • .NET Core
  • Node.js / JavaScript
    • Working with JavaScript
    • Node.js Tutorial
    • Node.js Debugging
    • Node.js Deployment
    • Browser Debugging
    • Angular Tutorial
    • React Tutorial
    • Vue Tutorial
    • Ember Tutorial
    • Debugging Recipes
    • Extensions
  • TypeScript
    • Tutorial
    • Compiling
    • Debugging
  • Python
    • Tutorial
    • Editing Code
    • Linting
    • Debugging
    • Environments
    • Testing
    • Data Science
    • Python Interactive
    • Django Tutorial
    • Flask Tutorial
    • Create containers
    • Python on Azure
    • Settings Reference
  • Java
    • Getting Started
    • Navigate and Edit
    • Refactoring
    • Formatting and Linting
    • Project Management
    • Build Tools
    • Run and Debug
    • Testing
    • Spring Boot
    • Application Servers
    • Java on Azure
    • Extensions
    • FAQ
  • C++
    • Intro Videos
    • GCC on Linux
    • GCC on Windows
    • GCC on Windows Subsystem for Linux
    • Clang on macOS
    • Microsoft C++ on Windows
    • CMake Tools on Linux
    • Debugging
    • Editing
    • Settings
    • Configure IntelliSense for cross-compiling
    • FAQ
  • Containers
    • Overview
    • Node.js
    • Python
    • ASP.NET Core
    • Debug
    • Docker Compose
    • Registries
    • Deploy to Azure
    • Choose a dev environment
    • Customize
    • Develop with Kubernetes
    • Tips and Tricks
  • Data Science
    • Overview
    • Jupyter Notebooks
    • Data Science Tutorial
    • Python Interactive
    • PyTorch Support
  • Azure
    • Extensions
    • Deployment
    • Remote Debugging for Node.js
    • Docker
    • MongoDB
    • Kubernetes
  • Remote
    • Overview
    • SSH
    • Containers
    • Windows Subsystem for Linux
    • GitHub Codespaces
    • SSH Tutorial
    • Containers Tutorial
    • WSL Tutorial
    • Attach to Container
    • Create a Dev Container
    • Advanced Containers
    • devcontainer.json
    • Tips and Tricks
    • FAQ

Topics

Java build tools in VS Code

This document will give you an overview of how work with your Java build tools in Visual Studio Code. It covers the Maven for Java extension as well as other tools.

If you run into any issues when using the features below, you can contact us by clicking the Report an issue button below.

Report an issue

Maven

Maven is a software tool that helps you manage Java projects and automate application builds. The Maven for Java extension for Visual Studio Code provides fully integrated Maven support, allowing you to explore Maven projects, execute Maven commands, and perform the goals of build lifecycle and plugins.

Install the Maven for Java extension

Exploring Maven project

Once a Maven project is loaded, the extension will be activated and it will automatically scan for pom.xml files in your workspace and displays all Maven projects and their modules in the side bar.

Maven Explorer

Resolve unknown type

The Maven extension also supports searching Maven Central to resolve unknown types in your source code. You can do this by selecting the Resolve unknown type link shown on hover.

Working with POM.xml

The extension provides code snippets and auto completion for adding Maven dependencies based on local Maven repositories. See how easy it is to add a new dependency to your pom.xml with those convenient features.

The extension also enables you to generate effective POM.

You can also use the command Maven: Add a Dependency (or maven.project.addDependency) to help add a new dependency to pom.xml. The process is interactive.

You can also add dependencies through the project view, which calls the same Maven command.

Furthermore, VS Code also supports showing dependencies in a tree view, which allows you to inspect all dependencies in your project at a single place and check for potential issues.

Execute Maven commands and goals

By right-clicking each Maven project in the explorer, you can conveniently run Maven goals.

The extension also preserves the history of goals for each project, so you can quickly rerun the previous command, which is useful when you're running a long custom goal.

There are two ways to rerun a goal:

  1. Command Palette > Select Maven: History > Select a project > Select command from the history.
  2. Right-click a project > Click History > Select command from history.

You can also specify your favorite commands in settings for future execution.

For each plug-in you use with your project, the extension also provides you an easy way to access the goals within each plugin.

To debug Maven goals, right-click on a goal and start debugging. The Maven extension will call the Java debugger with the right parameters. This is a handy, time-saving feature.

Generate project from Maven Archetype

Another handy feature provided by this extension is to generate a Maven project from Archetype. The extension loads archetypes listed in local/remote catalogs. After selection, the extension sends mvn archetype:generate -D... to the terminal.

There are two ways to generate a Maven project:

  1. From the Maven explore, click +.

Create Maven Project

  1. Right-click on a folder and select Generate from Maven Archetype.

Gradle

VS Code supports basic Gradle Java project (not including Android). There are also a couple third party extensions available for writing .gradle files as well as running Gradle tasks.

  • Gradle Language Support
  • Gradle Tasks

Additional resources

Visit the GitHub Repo of the Maven extension for additional configurations and a troubleshooting guide.

In addition to Maven, there's also a Bazel extension if you use Bazel to build and test your project.

Next steps

Read on to find out more about:

  • Java Editing - Explore the editing features for Java in VS Code.
  • Java Debugging - Find out how to debug your Java project with VS Code.
  • Java Testing - Use VS Code for your JUnit and TestNG cases.
  • Java Extensions - Learn about more useful Java extensions for VS Code.
4/28/2021

In this article there are 3 sectionsIn this article

  • Maven
  • Gradle
  • Next steps
  • Hello from Seattle.
  • Follow @code
  • Support
  • Privacy
  • Manage Cookies
  • Terms of Use
  • License
Microsoft homepage Microsoft homepage © 2021 Microsoft