mvn --version
우도비
Creating Your Project with Maven 본문
https://gorkem1.gitbooks.io/visual-studio-code-for-java/chapter-1/Maven-Create.html
Creating Your Project with Maven
Java extension can use information contained on Maven build artifacts to extract information such as the location of source files, dependencies and compiler preferences. Most convenient way to start developing a Java project using VS Code and Maven is to create a project using maven archetypes.
Important | Maven is a Java tool, so you must have Java installed in order to proceed. |
First, download Maven and follow the installation instructions and verify your installation
Invoke the maven quickstart archetype to generate your new project.
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Start VS Code with the new project
code ./my-app
At this point your project can be edited with VS Code and you should be getting Java language features such as code assist.
Running tests
The maven quickstart archetype also generates an example test, let’s setup your VS Code to run these tests.
In the Command Palette, filter on 'task' and select the Tasks: Configure Task Runner command. You will see a list of task runner templates, select maven to create maven based test task.
Figure 2. Maven task templateYou should now have a
tasks.json
file with following content.tasks.json{ "version": "0.1.0", "command": "mvn", "isShellCommand": true, "showOutput": "always", "suppressTaskName": true, "tasks": [ { "taskName": "verify", "args": ["-B", "verify"], "isBuildCommand": true }, { "taskName": "test", "args": ["-B", "test"], "isTestCommand": true } ] }
Using Command Palette, filter on 'task' and select the Tasks: Run Test Task command. The OUTPUTpanel will open and you’ll see the results of test execution.
Building your project
Create a tasks.json
file by following steps 1 and 2. Invoke the build task by Tasks: Run Build Task or its shortcut.
Note | Default template for maven invokes |