当前位置:   article > 正文

Maven中本地仓库,中央镜像,JDK版本配置_repository for jdk 1.4 builds

repository for jdk 1.4 builds

配置本地仓库的位置,根据自己的情况自己修改:

  <localRepository>E:\eclipse\RepMaven</localRepository>

配置中央仓库镜像,下载jar包快:

  1. <mirror>
  2. <id>nexus-aliyun</id>
  3. <name>nexus-aliyun</name>
  4. <url>http://maven.aliyun.com/nexus/content/groups/public</url >
  5. <mirrorOf>central</mirrorOf>
  6. </mirror>

配置JDK版本

  1. <profile>
  2. <id>jdk-1.8</id>
  3. <activation>
  4. <activeByDefault>true</activeByDefault>
  5. <jdk>1.8</jdk>
  6. </activation>
  7. <properties>
  8. <maven.compiler.source>1.8</maven.compiler.source>
  9. <maven.compiler.target>1.8</maven.compiler.target>
  10. <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
  11. </properties>
  12. </profile>
<profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile>

setting.xml

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

     

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/87803
推荐阅读
相关标签
  

闽ICP备14008679号