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

Maven-profile

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

What is the purpose of profile?

In our actual development process, there will be dev, test, product and other environments, or different operations OS. They may require different configuration parameters, such as databases. The usual practice is to change our code or the same properties file while switching environments. Based on this, maven2.0 provides a better choice for developers. Profiles is used to build different project in different environments.

What can be configured with profile?

Pom.xml system users in the project maven setting:%USER_HOME%/.m2/settings.xml global maven setting: (${maven.home} / conf/settings.xml) profile descriptor: (profiles.xml) in project basedir

What is the purpose of different profile configurations?

There are essentially two categories: one is maven setting, which works on all project, usually with configurations that do not affect project build in such files. Such as:, (can be referenced by the properties attribute in pom through wildcards). The other is pom.xml, which acts on a single project or its child module, usually configuring the parameters that affect the project build in the profile in pom.xml, such as:,.

How to activate profile?

"mvn command line-P, such as:"

Tags in mvn groupId:artifactId:goal-P profile-1,profile-2settings.xml, such as:... profile-1...* based on JDK environment (automatic detection), such as:

1.4

...

* according to OS, such as:

Windows XP

Windows

X86

5.1.2600

...

* specify the parameter: mvn groupId:artifactId:goal-Ddebug=false on the command line at the same time as specified in. Such as:

Debug

...

* according to the automatic activation in, such as:

Profile-1

True

...

* according to, and, such as:

Target/generated-sources/axistools/wsdl2java/org/apache/maven

...

* * what can be modified by profile in pom.xml? * * (not actually available in the main POM, but used behind the scenes) * a subset of the element, which consists of: * * how to check which profiles is valid? * * mvn help:active-profiles mvn help:active-profiles-P appserverConfig-dev mvn help:active-profiles-Denv=dev reference document: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

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