Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the configuration steps for Maven environment isolation and Maven environment isolation

Shulou Source: shulou.com Published: 2022-06-03 18:05:44 11月13日 Update

This article introduces the knowledge of "what is Maven environment isolation and the configuration steps of Maven environment isolation". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

What is Maven environment isolation

As the name implies, Maven environment isolation is to separate the environment under development to facilitate development. This is used quite a lot in the actual project, if your project uses Maven build but does not use environmental isolation, please immediately do environmental isolation of the project, believe me, you will come back to follow me!

Project environment

We are generally divided into the following four categories

Local development environment (Local)

Development environment (Dev)

Test environment (Beta)

Online environment (Prod)

Again, Maven helps us avoid the disadvantages of manual modification, that is, easy to make mistakes, easy to compile in different environments, packaging, deployment and so on.

Maven environment isolation configuration

1. Add under the build node in pom.xml

Src/main/resources.$ {deploy.type} * .jsp src/main/resources

2. Add profiles node to pom.xml

Dev true dev beta beta prod prod

3. According to the profile, we need to create a new resource folder.

4. Add the packaging command when compiling and packaging-P$ {environment identification}

Mvn clean package-Dmaven.test.skip=true-Pdev

After that, you can see the corresponding environment configuration in target. It is important to note that the choice of Profiles under Maven Project is the version at the time of release, that is, the environment parameters when publishing to Tomcat.

This is the end of the content of "what is Maven environment isolation and the configuration steps of Maven environment isolation". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Environment isolation configuration project development steps content reality more knowledge nodes compilation utility as the name implies learning and then in use manual again parameters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL Xiaomi Redmi Shulou Information