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

How to deploy the vuejs project to tomcat

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "how the vuejs project is deployed to tomcat". In the daily operation, I believe many people have doubts about how to deploy the vuejs project to tomcat. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to deploy the vuejs project to tomcat". Next, please follow the editor to study!

Vuejs project deployment to tomcat methods: 1, download tomcat and decompress; 2, modify the "config/index.js" under vue; 3, add "base:'/aoxinwechat/'"; 4, execute npm run build;5, start tomcat.

This article operating environment: Windows7 system, Vue2.9.6, Dell G3 computer.

How is the vuejs project deployed to tomcat?

Deploy the vue project to tomcat:

1. Prerequisites: if the java environment is configured, download tomcat and decompress https://tomcat.apache.org/download-80.cgi to get the following directory

2. Modify the config/index.js under the vue project. Note that both dev and build need to change the configuration of assetsPublicPath.

Module.exports = {dev: {... AssetsPublicPath:'. /',...}, build: {. AssetsPublicPath:'. /',.}}

3. Modify the routing configuration src/router/index.js and add the configuration base:'/ aoxinwechat/', if it is not configured here, the access to the home page of the deployed project will be blank, but no error will be reported, and the introduced files will be loaded normally

Export default new Router ({/ / if the packaged file is stored under Tomcat/webapps/aoxinwechat, / / then base will write base:'/ aoxinwechat/', mode: 'history', routes: [.]})

4. Execute npm run build and paste everything under the dist directory generated by the package into the Tomcat/webapps/aoxinwechat path. Aoxinwechat is the custom project name.

5. Start tomcat, double-click the startup.bat file in the bin directory under tomcat, or open the command line to access startup.bat

Access path format > > ip:port/aoxinwechat, for example: http://localhost:8080/aoxinwechat/, you can access the Vue project.

At this point, the study on "how to deploy the vuejs project to tomcat" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report