Maven settings.xml configuration understanding

Maven settings.xml configuration understanding


<?xml version="1.0" encoding="UTF-8"?>
<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">

	<!--
	//local warehouse address
	-->
	<localRepository> D: \ mavenTest \ repo </localRepository>

	<!--
	//A list of organization IDs (groupId) for searching plugins when the plugin's organization ID (groupId) is not explicitly provided.
	//This element contains a list of pluginGroup elements, and each child element contains an organization ID (groupId).
	// This list is used by Maven when we use a plugin and don't provide it with an organization ID (groupId) on the command line.
	//By default this list includes org.apache.maven.plugins.
	-->
	<pluginGroups>
	</pluginGroups>

	<!--
	//Used to configure different agents, multi-agent profiles can cope with the working environment of laptops or mobile devices: by simply setting the profile id, the entire agent configuration can be easily replaced.
	-->
	<proxies>
	</proxies>

	<!--
	//The project is published to the private server configuration,
	//Configure some settings of the server (provide the necessary information to connect to the server), because the connection to the server needs to be authenticated, here is the configuration authentication information
	-->
	<servers>
		<server>
			<!--
			//This is the id of the server (note that it is not the id of the user login), which matches the id of the repository element in distributionManagement (in the pom.xml file).
			-->
			<id>nexus-releases</id>
			<!--
			//Authentication username. The authentication user name and authentication password indicate the login name and password required for server authentication.
			-->
			<username>xing</username>
			<password>123456</password>
		</server>
		<server>
			<id>nexus-snapshots</id>
			<username>xing</username>
			<password>123456</password>
		</server>
	</servers>

	<!--
	//The list of downloaded mirrors configured for the repository list. That is, when there is no jar locally, go to the server here to download it back to the local warehouse
	-->
	<mirrors>
		<mirror>
			<!--
			// Unique identifier for this image. id is used to distinguish different mirror elements. Change your name
			-->
			<id>public</id>
			<!--
			// The id of the mirrored server. For example, if we want to set up a mirror of the Maven central repository (http://repo1.maven.org/maven2),
            		//You need to set the element to central. This must be exactly the same as the id central of the central repository.
            		//* means match all remote repositories.
            		// The id of the mirrored server. is the repository ID on the server you want to mirror
			-->
			<mirrorOf>*</mirrorOf>
			<!--
			// URL of the mirror. The build system will use this URL in preference to the default server URL. The mirrored URL is configured by the mirror server
			-->
			<url>http://localhost:8081/nexus/content/groups/public</url>
		</mirror>
	</mirrors>

	<!--
	//A parameter description of remote warehouse information
	-->
	<profiles>
		<profile>
			<!--//The unique identifier for this configuration. -->
			<id>nexus</id>
			<!--
			//Remote repository list, which is a set of remote projects used by Maven to populate the local repository of the build system.
			-->
			<repositories>
				<repository>
					<!--//Remote warehouse unique identifier-->
					<id>public</id>
					<!--//Remote warehouse name-->
					<name>Public Repositories</name>
					<url>http://localhost:8081/nexus/content/groups/public</url>
					 <!--
					 //How to handle the download of the snapshot version in the remote repository. With the two sets of configurations releases and snapshots,
					 //POM can take a different strategy for each type of component in each individual repository. E.g,
					 //Maybe someone decides to enable support for snapshot version downloads only for development purposes.
					 //See repositories/repository/releases element
					 -->
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
					<!--//How to handle the download of the release version in the remote warehouse-->
					<releases>
						<!--//true or false indicates whether the repository is enabled for downloading a certain type of component (release version, snapshot version). -->
						<enabled>true</enabled>
					</releases>
				</repository>
			</repositories>
			<!--
			//List of remote repositories where plugins are found. The warehouse is home to two main components. The first type of component is used as a dependency of other components. This is stored in the central warehouse
			//Most component types. Another type of widget is a plugin. A Maven plugin is a special type of artifact. For this reason, the plugin repository is independent of its
			//it repository. The structure of the pluginRepositories element is similar to the structure of the repositories element. Each pluginRepository element specifies a
			// A remote address that Maven can use to find new plugins.
			-->
			<pluginRepositories>
				<pluginRepository>
					<id>public</id>
					<name>Public Repositories</name>
					<url>http://localhost:8081/nexus/content/groups/public</url>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>

 	<!--
 	//List of manually activated profiles, define activeProfile in the order in which profiles are applied. This element contains a set of activeProfile elements, each activeProfile contains a profile id.
 	//Indicates that those Profiles are available, and those that are not in the list cannot be used
 	//The activated profile will apply the repository configuration to the project.
 	-->
	<activeProfiles>
		<activeProfile>nexus</activeProfile>
	</activeProfiles>

</settings>




Refer to the original text (setting.xml detailed explanation): http://www.cnblogs.com/yangxia-test/p/4409736.html
Refer to the original text (mirrorOf in Maven settings configuration): http://blog.csdn.net/isea533 /article/details/21560089
Reference text (profile introduction): http://elim.iteye.com/blog/1900568
Reference text (setting.xml configuration file details): http://blog.csdn.net/u012152619/article /details/51485152
refer to the original text (the difference between mirror and repository): http://blog.csdn.net/caomiao2006/article/details/40401517


See the attachment for examples:

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326945801&siteId=291194637