Maven configuring setting XML details -- properties, repositories

Chen Bucheng I 2022-06-24 07:44:18 阅读数:324



effect : Corresponding profile List of extended properties . maven Properties and ant The properties in are the same , Can be used to store some values . These values can be in pom.xml Use a marker anywhere in the ${X} To use , here X Is the name of the attribute . There are five different forms of attributes , And they can all be in settings.xml File access .

1. env.X: Add... Before a variable "env." The prefix of , Will return a shell environment variable . for example ,"env.PATH" It refers to $path environment variable ( stay Windows On is %PATH%).
2. project.x: It refers to POM The corresponding element value in . for example : <project><version>1.0</version></project> adopt ${project.version} get version Value .
3. settings.x: It refers to settings.xml The value of the corresponding element in . for example :<settings><offline>false</offline></settings> adopt ${settings.offline} get offline Value .
4. Java System Properties: All can be done through java.lang.System.getProperties() Access properties can be in POM Use this form to access , for example ${java.home}.
5. x: stay <properties/> In the elements , Or set in an external file , With ${someVar} In the form of .

notes : If it's time to profile To be activated , Can be in pom.xml Use in ${user.install}.


effect : Remote warehouse list , It is maven It is used to fill in a set of remote warehouses used to build the local warehouse of the system .

<!-- Contains information that needs to be connected to the remote warehouse -->
<!-- Remote warehouse unique identification -->
<!-- Remote warehouse name -->
<name>Codehaus Snapshots</name>
<!-- How to deal with the download of the released version in the remote warehouse -->
<!--true perhaps false Indicates whether the repository is downloading a certain type of component ( Release , Snapshot version ) Turn on . -->
<!-- This element specifies how often updates occur .Maven It's more local POM And remote POM The timestamp . The option here is :always( always ),daily( Default , everyday ),interval:X( here X It's a time interval in minutes ), perhaps never( never ). -->
<!-- When Maven What to do when verifying component validation file fails -ignore( Ignore ),fail( Failure ), perhaps warn( Warning ). -->
<!-- How to handle the download of snapshot version in remote warehouse . With releases and snapshots These two sets of configurations ,POM It can be in every single warehouse , Take different strategies for each type of component . for example , Someone may decide to turn on support for snapshot version download for development purposes only . See repositories/repository/releases Elements -->
<enabled />
<updatePolicy />
<checksumPolicy />
<!-- Remote warehouse URL, Press protocol://hostname/path form -->
<!-- Type of warehouse layout used to locate and sort components - It can be default( Default ) perhaps legacy( Legacy ).Maven 2 Provides a default layout for its warehouse ; However ,Maven 1.x There is a different layout . We can use this element to specify that the layout is default( Default ) still legacy( Legacy ). -->
copyright:author[Chen Bucheng I],Please bring the original link to reprint, thank you.