Maven installation and configuration, Maven installation Configuration
<Settings xmlns = "http://maven.apache.org/SETTINGS/1.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> ignore <offline/> <pluginGroups/> ignore <servers/> ignore <mirrors/> <proxies /> ignore <profiles/> <activeProfiles/> </settings>
The following expressions can be used for the settings:
However, attributes defined in profiles cannot be referenced in this way.
<LocalRepository >$ {user. home }/. m2/repository </localRepository> the location of the local code library <interactiveMode> true </interactiveMode> indicates whether to select 123 <usePluginRegistry> false </usePluginRegistry> <offline> false </offline>. online
<Mirrors> <mirror> <id> planetemedi.com </id> <name> PlanetMirror Australia </name> <url> http://downloads.planetmirror.com/pub/maven2 </url> image address <mirrorOf> central </mirrorOf> corresponding code library </mirror> </mirrors>
However, each code library can only correspond to one image. If there are multiple images, select the first one.
Official Address:Http://repo.maven.apache.org/maven2Http://uk.maven.org/maven2, USA In the UK.
About mirrorOf:
- * = Used for all
- External: * = all non-local
- Repo, repo1 = repo or repo1
- *,! Repo1 = All,
Profile of Setting. xmlYesIn pom. xml ProfileIncludingActivation,Repositories,PluginRepositories,Properties.
Because he only cares about global settings and has nothing to do with specific projects.
If it takes effect, it will overwrite the specific POM orProfiles. xmlSet
<Profiles> <profile> <id> test </id> <activation> indicates the effective situation, <activeByDefault> false </activeByDefault> <jdk> 1.5 </jdk> <OS> <name> Windows XP </name> <family> Windows </family> <arch> x86 </arch> <version> 5.1.2600 </version> </OS> <property> <name> mavenVersion </name> <value> 2.0.3 </value> </ property> <file> <exists >$ {basedir}/file2.properties </exists> <missing >$ {basedir}/file1.properties </missing> </file> </activation>. .. </profile> </profiles>
ActivationNot to allowProfileThe only method that takes effect.ActiveProfileYou can also have a profile'sId. You can enable it explicitly in the command line.
<ActiveProfiles> <activeProfile> env-test </activeProfile> profile id, which is activated by default. It can be executed normally without being activated. </activeProfiles>
<Profiles> <profile>... <properties> define a global attribute <user. install >$ {user. home}/our-project </user. install> </properties>... </profile> </profiles>
The properties in Profile can be referenced in pom. xml using the expression $ {xx} in any way:
<Profiles> <profile>... <repositories> specific code library location <repository> <id> codehausSnapshots </id> <name> Codehaus Snapshots </name> <releases> official version <enabled> false </enabled> <updatePolicy> always </updatePolicy> Update policy <checksumPolicy> warn </checksumPolicy> Validation policy </releases> <snapshots> preview <enabled> true </enabled> <updatePolicy> never </ updatePolicy> <checksumPolicy> fail </checksumPolicy> </snapshots> <url> http://snapshots.maven.codehaus.org/maven2 </url> <layout> default </layout> ignore </repository> </repositories> <pluginRepositories>... </pluginRepositories>... </profile> </profiles>
<UpdatePolicy> can be the following values:Always,Daily(Default ),Interval: X(Several minutes ),Never.
<ChecksumPolicy> it can be the following values:Ignore,Fail,Warn
PluginRepositoriesThe structure is the same as that of repositories.