Maven采用全局配置的方案:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <!--
  4. Licensed to the Apache Software Foundation (ASF) under one
  5. or more contributor license agreements. See the NOTICE file
  6. distributed with this work for additional information
  7. regarding copyright ownership. The ASF licenses this file
  8. to you under the Apache License, Version 2.0 (the
  9. "License"); you may not use this file except in compliance
  10. with the License. You may obtain a copy of the License at
  11.  
  12. http://www.apache.org/licenses/LICENSE-2.0
  13.  
  14. Unless required by applicable law or agreed to in writing,
  15. software distributed under the License is distributed on an
  16. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. KIND, either express or implied. See the License for the
  18. specific language governing permissions and limitations
  19. under the License.
  20. -->
  21.  
  22. <!--
  23. | This is the configuration file for Maven. It can be specified at two levels:
  24. |
  25. | 1. User Level. This settings.xml file provides configuration for a single user,
  26. | and is normally provided in ${user.home}/.m2/settings.xml.
  27. |
  28. | NOTE: This location can be overridden with the CLI option:
  29. |
  30. | -s /path/to/user/settings.xml
  31. |
  32. | 2. Global Level. This settings.xml file provides configuration for all Maven
  33. | users on a machine (assuming they're all using the same Maven
  34. | installation). It's normally provided in
  35. | ${maven.home}/conf/settings.xml.
  36. |
  37. | NOTE: This location can be overridden with the CLI option:
  38. |
  39. | -gs /path/to/global/settings.xml
  40. |
  41. | The sections in this sample file are intended to give you a running start at
  42. | getting the most out of your Maven installation. Where appropriate, the default
  43. | values (values used when the setting is not specified) are provided.
  44. |
  45. |-->
  46. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  47. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  48. xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  49. <!-- localRepository
  50. | The path to the local repository maven will use to store artifacts.
  51. |
  52. | Default: ${user.home}/.m2/repository-->
  53. <localRepository>C:\Users\Administrator\.m2\repository</localRepository>
  54.  
  55. <!-- interactiveMode
  56. | This will determine whether maven prompts you when it needs input. If set to false,
  57. | maven will use a sensible default value, perhaps based on some other setting, for
  58. | the parameter in question.
  59. |
  60. | Default: true
  61. <interactiveMode>true</interactiveMode>
  62. -->
  63.  
  64. <!-- offline
  65. | Determines whether maven should attempt to connect to the network when executing a build.
  66. | This will have an effect on artifact downloads, artifact deployment, and others.
  67. |
  68. | Default: false
  69. <offline>false</offline>
  70. -->
  71.  
  72. <!-- pluginGroups
  73. | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
  74. | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
  75. | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
  76. |-->
  77. <pluginGroups>
  78. <!-- pluginGroup
  79. | Specifies a further group identifier to use for plugin lookup.
  80. <pluginGroup>com.your.plugins</pluginGroup>
  81. -->
  82. </pluginGroups>
  83.  
  84. <!-- proxies
  85. | This is a list of proxies which can be used on this machine to connect to the network.
  86. | Unless otherwise specified (by system property or command-line switch), the first proxy
  87. | specification in this list marked as active will be used.
  88. |-->
  89. <proxies>
  90. <!-- proxy
  91. | Specification for one proxy, to be used in connecting to the network.
  92. |
  93. <proxy>
  94. <id>optional</id>
  95. <active>true</active>
  96. <protocol>http</protocol>
  97. <username>proxyuser</username>
  98. <password>proxypass</password>
  99. <host>proxy.host.net</host>
  100. <port>80</port>
  101. <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
  102. </proxy>
  103. -->
  104. </proxies>
  105.  
  106. <!-- servers
  107. | This is a list of authentication profiles, keyed by the server-id used within the system.
  108. | Authentication profiles can be used whenever maven must make a connection to a remote server.
  109. |-->
  110. <servers>
  111. <!-- server
  112. | Specifies the authentication information to use when connecting to a particular server, identified by
  113. | a unique name within the system (referred to by the 'id' attribute below).
  114. |
  115. | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
  116. | used together.
  117. |
  118. <server>
  119. <id>deploymentRepo</id>
  120. <username>repouser</username>
  121. <password>repopwd</password>
  122. </server>
  123. -->
  124.  
  125. <!-- Another sample, using keys to authenticate.-->
  126. <server>
  127. <id>nexus-releases</id>
  128. <username>admin</username>
  129. <password>admin123</password>
  130. </server>
  131. <server>
  132. <id>nexus-snapshots</id>
  133. <username>admin</username>
  134. <password>admin123</password>
  135. </server>
  136.  
  137. </servers>
  138.  
  139. <!-- mirrors
  140. | This is a list of mirrors to be used in downloading artifacts from remote repositories.
  141. |
  142. | It works like this: a POM may declare a repository to use in resolving certain artifacts.
  143. | However, this repository may have problems with heavy traffic at times, so people have mirrored
  144. | it to several places.
  145. |
  146. | That repository definition will have a unique id, so we can create a mirror reference for that
  147. | repository, to be used as an alternate download site. The mirror site will be the preferred
  148. | server for that repository.
  149. |-->
  150. <mirrors>
  151. <!-- mirror
  152. | Specifies a repository mirror site to use instead of a given repository. The repository that
  153. | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
  154. | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
  155. | -->
  156. <mirror>
  157. <id>offical</id>
  158. <name>Maven Official Repository</name>
  159. <url>http://repo1.maven.org/maven2</url>
  160. <mirrorOf>central</mirrorOf>
  161. </mirror>
  162. <mirror>
  163. <id>jboss</id>
  164. <name>Jboss Repository</name>
  165. <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
  166. <mirrorOf>central</mirrorOf>
  167. </mirror>
  168. <mirror>
  169. <id>AsposeJavaAPI</id>
  170. <name>Aspose Java API</name>
  171. <url>http://maven.aspose.com/repository/repo</url>
  172. <mirrorOf>*</mirrorOf>
  173. </mirror>
  174. <mirror>
  175. <id>mvn</id>
  176. <name>Mvn Repository</name>
  177. <url>https://mvnrepository.com/</url>
  178. <mirrorOf>central</mirrorOf>
  179. </mirror>
  180. </mirrors>
  181.  
  182. <!-- profiles
  183. | This is a list of profiles which can be activated in a variety of ways, and which can modify
  184. | the build process. Profiles provided in the settings.xml are intended to provide local machine-
  185. | specific paths and repository locations which allow the build to work in the local environment.
  186. |
  187. | For example, if you have an integration testing plugin - like cactus - that needs to know where
  188. | your Tomcat instance is installed, you can provide a variable here such that the variable is
  189. | dereferenced during the build process to configure the cactus plugin.
  190. |
  191. | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
  192. | section of this document (settings.xml) - will be discussed later. Another way essentially
  193. | relies on the detection of a system property, either matching a particular value for the property,
  194. | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
  195. | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
  196. | Finally, the list of active profiles can be specified directly from the command line.
  197. |
  198. | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
  199. | repositories, plugin repositories, and free-form properties to be used as configuration
  200. | variables for plugins in the POM.
  201. |
  202. |-->
  203. <profiles>
  204. <!-- profile
  205. | Specifies a set of introductions to the build process, to be activated using one or more of the
  206. | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
  207. | or the command line, profiles have to have an ID that is unique.
  208. |
  209. | An encouraged best practice for profile identification is to use a consistent naming convention
  210. | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
  211. | This will make it more intuitive to understand what the set of introduced profiles is attempting
  212. | to accomplish, particularly when you only have a list of profile id's for debug.
  213. |
  214. | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
  215. <profile>
  216. <id>jdk-1.4</id>
  217.  
  218. <activation>
  219. <jdk>1.4</jdk>
  220. </activation>
  221.  
  222. <repositories>
  223. <repository>
  224. <id>jdk14</id>
  225. <name>Repository for JDK 1.4 builds</name>
  226. <url>http://www.myhost.com/maven/jdk14</url>
  227. <layout>default</layout>
  228. <snapshotPolicy>always</snapshotPolicy>
  229. </repository>
  230. </repositories>
  231. </profile>
  232. -->
  233.  
  234. <!--
  235. | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
  236. | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
  237. | might hypothetically look like:
  238. |
  239. | ...
  240. | <plugin>
  241. | <groupId>org.myco.myplugins</groupId>
  242. | <artifactId>myplugin</artifactId>
  243. |
  244. | <configuration>
  245. | <tomcatLocation>${tomcatPath}</tomcatLocation>
  246. | </configuration>
  247. | </plugin>
  248. | ...
  249. |
  250. | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
  251. | anything, you could just leave off the <value/> inside the activation-property.
  252. |
  253. <profile>
  254. <id>env-dev</id>
  255.  
  256. <activation>
  257. <property>
  258. <name>target-env</name>
  259. <value>dev</value>
  260. </property>
  261. </activation>
  262.  
  263. <properties>
  264. <tomcatPath>/path/to/tomcat/instance</tomcatPath>
  265. </properties>
  266. </profile>
  267. -->
  268. <profile>
  269. <id>dev</id>
  270. <repositories>
  271. <repository>
  272. <id>local-nexus</id>
  273. <url>http://192.168.110.225:8081/nexus/content/groups/public</url>
  274. <releases>
  275. <enabled>true</enabled>
  276. </releases>
  277. <snapshots>
  278. <enabled>true</enabled>
  279. </snapshots>
  280. </repository>
  281. </repositories>
  282. </profile>
  283. <!-- Ƥ׃Ѿ֘Ӗࠢ -->
  284. </profiles>
  285.  
  286. <!-- ǴԃѾ֘Ӗࠢ -->
  287. <activeProfiles>
  288. <activeProfile>dev</activeProfile>
  289. </activeProfiles>
  290.  
  291. <!-- activeProfiles
  292. | List of profiles that are active for all builds.
  293. |
  294. <activeProfiles>
  295. <activeProfile>alwaysActiveProfile</activeProfile>
  296. <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  297. </activeProfiles>
  298. -->
  299. </settings>

Maven 3.3全局配置的更多相关文章

  1. Maven使用(一)—— Maven的安装与全局配置

    一.Maven安装 Maven的安装步骤: 1.Maven官网(http://maven.apache.org/)下载压缩包,解压缩,当前最新版本是apache-maven-3.5.3-bin.zip ...

  2. maven工程指定jdk版本,maven全局配置jdk的版本

  3. IDEA修改Maven全局配置

    在使用过程中发现,IDEA每次新建一个Project ,这个maven配置都会初始化默认的. 这里需要设置下全局配置: File -> Other Settings -> Settings ...

  4. Maven的安装、配置及使用入门

    Maven的安装.配置及使用入门 本书代码下载 大家可以从我的网站下载本书的代码:http://www.juvenxu.com/mvn-in-action/,也可以通过我的网站与我取得联系,欢迎大家与 ...

  5. 1.Maven的安装及配置

    1 Maven 介绍 Maven这个词可以翻译为“知识的积累”,也可以翻译为“专家”或“内行”.本书将介绍Maven这一跨平台的项目管理工具.作为Apache组织中的一个颇为成功的开源项目,Maven ...

  6. Apache Maven 3.6.1配置安装

    Apache Maven 3.6.1配置安装 一.下载 maven下载地址:http://maven.apache.org/download.cgi 二.安装 1,解压即可用 2,环境变量配置 MAV ...

  7. 架构(二)Maven安装以及Nexus配置

    一 Maven安装配置 1.1 下载 http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-ma ...

  8. Jenkins Jenkins结合GIT Maven持续集成环境配置

    Jenkins结合GIT Maven持续集成环境配置   by:授客 QQ:1033553122 安装Git插件 1 安装Git客户端 1 安装JAVA JDK及MAVEN 2 Jenkins JDK ...

  9. Java开发环境配置(4)--Maven安装 环境变量配置,本地仓库配置---插件安装

    说明在前:本人用过的 luna  mars 等,都已经自带maven插件的了,以下有些文章是很老的,讲到maven插件的安装都可以忽略掉. maven安装eclipse在线配置maven搞定所有插件_ ...

随机推荐

  1. 2018-2019-2 《网络对抗技术》Exp0 Kali安装 Week1 20165318

    2018-2019-2 <网络对抗技术>Exp0 Kali安装 Week1 20165318 下载地址 Kali官网,选择Kali Linux 64 bit VMware 安装步骤 以下步 ...

  2. RESTful API实战笔记(接口设计及Java后端实现)

    写在前面的话 原计划这部分代码的更新也是上传到ssm-demo仓库中,因为如下原因并没有这么做: 有些使用了该项目的朋友建议重新创建一个仓库,因为原来仓库中的项目太多,结构多少有些乱糟糟的. 而且这次 ...

  3. 1092 回文字符串(LCSL_DP)

    1092 回文字符串 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 回文串是指aba.abba.cccbccc.aaaa这种左右对称的字符串.每个字符 ...

  4. 如何在Windows平台下安装配置Memcached

    Memcached是一个自由开源的,高性能,分布式内存对象缓存系统. Memcached是以LiveJournal旗下Danga Interactive公司的Brad Fitzpatric为首开发的一 ...

  5. 怎样使用CSS3媒体查询(Media Queries)制作响应式网站

    自本周开始博主将开始同大家一起研究响应式web设计,CSS3 Media Queries是入门,本周更新,博主将给大家分享media queries的一些常用的用法及注意事项. Media Queri ...

  6. <数据结构与算法分析>读书笔记--最大子序列和问题的求解

    现在我们将要叙述四个算法来求解早先提出的最大子序列和问题. 第一个算法,它只是穷举式地尝试所有的可能.for循环中的循环变量反映了Java中数组从0开始而不是从1开始这样一个事实.还有,本算法并不计算 ...

  7. PAT A1126 Eulerian Path (25 分)——连通图,入度

    In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similar ...

  8. Linux 安装erlang

    安装rabbitmq的基础erlang1. 下载erlang 版本:otp_src_20.1.tar.gz 地址: http://erlang.org/download/?M=D 2.安装erlang ...

  9. 二、java三大特性--继承

    在讲解之前我们先看一个例子 Husband.java public class Husband { private String name; private String sex; privatein ...

  10. Vue-Vue列表渲染v-for

    v-for 指令需要以 site in sites 形式的特殊语法 一.v-for 循环数组 HTML代码 <div id="app"> <ul> < ...