Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example of vscode building a java development environment

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the example of vscode building java development environment, which is very detailed and has certain reference value. Friends who are interested must finish it!

Environment: the system needs to install jdk1.8 and configure the environment variable JAVA_HOME

Open vscode and install java-related plug-ins

Language support for Java ™for Visual Studio Code

Java Extension Pack

Debugger for Java

Java Test Runner

After the above plug-ins are installed, you can start java development.

Personal recommendation plug-in

Eclipse Keymap for Visual Studio Code. (eclipse shortcut key, favorite of eclipse users)

Lombok Annotations Support for VS Code. (simplified POJO, what a surprise)

Develop basic configuration

Common configuration items: file-> preferences-> Settings

1. Maven configuration (if maven is installed locally)

"java.configuration.maven.userSettings": "/ home/luokai/maven/apache-maven-3.3.9/conf/settings.xml"

< !-- 在mirrors 中配置 mirror -->

Recommended use of maven Ali warehouse: add in settings.xml

Alimaven aliyun maven http://maven.aliyun.com/nexus/content/repositories/central/ central

2. Global search ignores folders, and target files are often ignored when searching for files

"search.exclude": {"* / node_modules": true, "* * / bower_components": true, "* * / target": true, "* * / logs": true}

3. Junit test, the Java Test Runner plug-in runs the multi-module project test has a problem GitHub issues has been resolved:), in version 0.7.1

Recommend a tedious way: rely on maven

Tasks-> configure tasks

Add the following configuration to the tasks array:

"tasks": [{"label": "test:HelloWorld", "type": "shell", "command": "mvn-Dtest=HelloWorldTest#testHelloWorld test", "group": "test"}

Execute test:command: is to run the specified unit test, HelloWorldTest.testHelloWorld () method

Task-> run task

Select the test case you just added and run it perfectly.

4. Use tomcat to debug web projects

(1) install the Tomcat for Java plug-in

(2) Click the + sign to the right of TOMCAT SERVERS in the sidebar, and select the locally installed tomcat

(3) Select war package to run.

PS: pay attention to building the latest war package before debugging

Tips:

Cancel clicking to open the file to overwrite the navigation bar:

File-> preferences-> Settings, add "workbench.editor.enablePreview": false

These are all the contents of the article "vscode's example of building a java development environment". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report