Home >Development Tools >VSCode >Can vscode develop javaweb?

Can vscode develop javaweb?

王林
王林Original
2020-02-11 15:43:597394browse

Can vscode develop javaweb?

vscode can develop javaweb, but you need to configure the javaweb development environment before development.

Attachment: vscode configuration javaweb development environment

Basic environment

1, Java sdk

2, maven (compile, package and build Tool, used to generate a web project, you can understand this thing as front-end npm)

(1) Install maven

(2) After the installation is completed, you need to restart it (possibly restart The current command line window can also be used), the environment can take effect

3. tomcat (proxy server)

Preliminary preparation

Open the maven installation directory/ conf/setting.xml, replace the mirrors inside with the following code, which can speed up the construction, compilation, and testing of maven projects:

Note: Modifying setting.xml requires changing the user group permissions, otherwise it cannot be modified. (Of course, this may be related to your operating system and the drive letter location saved by maven. If you do not encounter any problems that cannot be modified, please ignore this message)

<mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>        
  </mirror>

vscode Install the Java Extension Pack plug-in, The plug-in will automatically install other plug-ins you need.

Create a project and package it

1. After the plug-in is installed successfully, restart vscode. Right-click on the project area on the left, you can see the MAVEN PROJECT, select the number Create a new project, or press ctrl shift p and enter maven, select Create Maven Project

2, select maven-archetype-webapp, maven will download various dependencies, and ask you to fill in groupId, artifactId (these two Id, can be repeated, the value of artifactld is the file name of the new project), etc., and then a java-web project will be created. Some can just press Enter to adopt the default value.

3. After executing mvn clean package to package the project, a .war file will be generated in the target directory.

Publish to the local tomcat server

Start tomcat and manually copy the .war file generated above to the webapps folder of the tomcat installation directory, assuming .war The file name is HelloWorld and enter http://localhost:8080/HelloWorld in the browser.

Recommended related tutorials: vscode tutorial

The above is the detailed content of Can vscode develop javaweb?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn