Maven配置教程

一:下载

     Maven – Download Apache Maven

二:解压

三:修改setting

   1.在<localRepository>标签内添加自己的本地位置路径
  <!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><localRepository>D:\tools\repository</localRepository>

2. 修改maven默认的JDK版本

在<profiles>标签下添加一个<profile>标签,修改maven默认的JDK版本。

<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>
3. 添加国内镜像源

添加<mirrors>标签下<mirror>,添加国内镜像源,这样下载jar包速度很快。默认的中央仓库有时候甚至连接不通。一般使用阿里云镜像库即可。这里我就都加上了,Maven会默认从这几个开始下载,没有的话就会去中央仓库了。

<!-- 阿里云仓库 -->
<mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror><!-- 中央仓库1 -->
<mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url>
</mirror><!-- 中央仓库2 -->
<mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo2.maven.org/maven2/</url>
</mirror>

四:idea intellij 修改maven

五:setting 文件

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user,|                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in|                 ${maven.conf}/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<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| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><localRepository>D:\tools\repository</localRepository><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).|| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are|       used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><mirrors><!-- mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>--><!-- 阿里云仓库 --><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url></mirror><!-- 中央仓库1 --><mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url></mirror><!-- 中央仓库2 --><mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo2.maven.org/maven2/</url></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| 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>--><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></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/584754.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

IDEA使用HDFS的JavaApi

注&#xff1a;以下代码操作是利用junit在java测试文件夹中实现。 1. 准备工作 1.1 创建测试类 创建测试类&#xff0c;并定义基本变量 public class HDFSJAVAAPI {// 定义后续会用到的基本变量public final String HDFS_PATH "hdfs://hadoop00/";Configuration …

Android studio CMakeLists.txt 打印的内容位置

最近在学习 cmake 就是在安卓中 , 麻烦的要死 , 看了很多的教程 , 发现没有 多少说对打印位置在哪里 , 先说一下版本信息 , 可能你们也不一样 gradle 配置 apply plugin: com.android.applicationandroid {compileSdkVersion 29buildToolsVersion "29.0.3"defau…

GPT编程(1)八分类图像数据集转换为二分类

一个核心问题就是要将这八类数据图片全部重命名&#xff0c;尝试了一步到位 有一个图像数据集&#xff0c;有八个类别amusement,anger,awe,contentment,disgust, excitement, fear,sadness的图片&#xff0c;每张图片被命名为“类别数字”。采用遍历的方式&#xff0c;按顺序阅…

Go语言学习第二天

Go语言数组详解 var 数组变量名 [元素数量]Type 数组变量名&#xff1a;数组声明及使用时的变量名。 元素数量&#xff1a;数组的元素数量&#xff0c;可以是一个表达式&#xff0c;但最终通过编译期计算的结果必须是整型数值&#xff0c;元素数量不能含有到运行时才能确认大小…

阿里云2核2G3M服务器放几个网站?

阿里云2核2g3m服务器可以放几个网站&#xff1f;12个网站&#xff0c;阿里云服务器网的2核2G服务器上安装了12个网站&#xff0c;甚至还可以更多&#xff0c;具体放几个网站取决于网站的访客数量&#xff0c;像阿里云服务器网aliyunfuwuqi.com小编的网站日访问量都很少&#xf…

java 企业工程管理系统软件源码+Spring Cloud + Spring Boot +二次开发+ 可定制化

工程项目管理软件是现代项目管理中不可或缺的工具&#xff0c;它能够帮助项目团队更高效地组织和协调工作。本文将介绍一款功能强大的工程项目管理软件&#xff0c;该软件采用先进的Vue、Uniapp、Layui等技术框架&#xff0c;涵盖了项目策划决策、规划设计、施工建设到竣工交付…

springboot整合hadoop遇错

错误一&#xff1a; Caused by: java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset. 解决&#xff1a; 下载&#xff1a;https://github.com/steveloughran/winutils 选择一个版本 例如&#xff1a;3.0.0 &#xff0c;将里面的hadoop.dll文件复制…

在IntelliJ IDEA中精通Git配置与使用:全面指南

目录 1 前言2 idea中使用git的准备2.1 在 IntelliJ IDEA 中配置 Git2.2 配置 Git 忽略文件 3 在IntelliJ IDEA中使用Git的基本步骤3.1 项目导入到 Git3.2 查看与切换版本信息 4 在 IntelliJ IDEA 中使用分支4.1 创建分支4.2 无冲突合并4.3 冲突合并 5 结语 1 前言 版本控制是现…

Linux(ubuntu)下git / github/gitee使用

先附上git命令 linuxchenxiao:~$ cd Templates/ 先进入一个目录&#xff0c;也可mkdir新建一个目录&#xff1a;用于接下来初始化为git可以管理的仓库 这个目录就是所说的工作目录&#xff0c;指当前正在进行开发的项目的本地目录。 linuxchenxiao:~/Templates$ git init 已…

[每周一更]-(第79期):Apache代理的配置

反向代理逻辑类似Nginx&#xff0c;以下具体展示属于apache的配置和参数说明 局部代理配置方式&#xff1a; # 配置包含https的需要打开 SSLProxyEngine on ProxyPass /api/small https://api.web.com/version1/small/ ProxyPassReverse /api/small https://api.web.com/versio…

直方图与均衡化

直方图 统计图像中相同像素点的数量。 使用cv2.calcHist(images, channels, mask, histSize, ranges)函数 images&#xff1a;原图像图像格式为uint8或float32&#xff0c;当传入函数时应用[]括起来&#xff0c;例如[img]。 channels&#xff1a;同样用中括号括起来&#xff…

如何确保云中高可用?聊聊F5分布式云DNS负载均衡

在当今以应用为中心的动态化市场中&#xff0c;企业面临着越来越大的压力&#xff0c;不仅需要提供客户所期望的信息、服务和体验&#xff0c;而且要做到快速、可靠和安全。DNS是网络基础设施的重要组成部分&#xff0c;拥有一个可用的、智能的、安全和可扩展的DNS基础设施是至…

工程(十六)——自己数据集跑Fast_livo

一、基础环境 Ubuntu20.04 ROS noetic PCL 1.8 Eigen 3.3.4 Sophus git clone https://github.com/strasdat/Sophus.git cd Sophus git checkout a621ff mkdir build && cd build && cmake .. make sudo make install 下面两个直接把包下载下来一起编译…

2023-12-29 服务器开发-Centos部署LNMP环境

摘要: 2023-12-29 服务器开发-Centos部署LNMP环境 centos7.2搭建LNMP具体步骤 1.配置防火墙 CentOS 7.0以上的系统默认使用的是firewall作为防火墙&#xff0c; 关闭firewall&#xff1a; systemctl stop firewalld.service #停止firewall systemctl disable fire…

Windows上ModbusTCP模拟Master与Slave工具的使用

场景 Modbus Slave 与 Modbus Poll主从设备模拟软件与Configure Virtual Serial串口模拟软件使用&#xff1a; Modebus Slave 与 Modbus Poll主从设备模拟软件与Configure Virtual Serial串口模拟软件使用_modbus poll激活-CSDN博客 数据对接协议为Modbus TCP,本地开发需要使…

C语言编程入门 – 编写第一个Hello, world程序

C语言编程入门 – 编写第一个Hello, world程序 C Programming Entry - Write the first application called “Hello, world!” By JacksonML C语言编程很容易&#xff01; 本文开始&#xff0c;将带领你走过C语言编程之旅&#xff0c;通过实例使你对她颇感兴趣&#xff0c;一…

GLTF编辑器实现逼真的石门模型

在线工具推荐&#xff1a; 3D数字孪生场景编辑器 - GLTF/GLB材质纹理编辑器 - 3D模型在线转换 - Three.js AI自动纹理开发包 - YOLO 虚幻合成数据生成器 - 三维模型预览图生成器 - 3D模型语义搜索引擎 在凹凸贴图中&#xff0c;每个像素点都包含了一个法线向量&#xff0…

楼宇对讲门铃选型分析

目前很多的高层住宅都使用了对讲门铃了&#xff0c;在频繁使用中&#xff0c;门铃会出现的越来越多种类&#xff0c;下面我就简单的介绍会有用到的几款芯片. 语音通话芯片&#xff1a;D34018,D34118,D5020,D31101; D34018 单片电话机通话电路&#xff0c;合并了必 需的放大器…

Nature | 大型语言模型(LLM)能够发现和产生新知识吗?

大型语言模型&#xff08;LLM&#xff09;是基于大量数据进行预训练的超大型深度学习模型。底层转换器是一组神经网络&#xff0c;这些神经网络由具有自注意力功能的编码器和解码器组成。编码器和解码器从一系列文本中提取含义&#xff0c;并理解其中的单词和短语之间的关系。通…

GPT-3: Language Models are Few-Shot Learners

GPT-3 论文 数据集 CommonCrawl&#xff1a;文章通过高质量参考语料库对CommonCrawl数据集进行了过滤&#xff0c;并通过模糊去重对文档进行去重&#xff0c;且增加了高质量参考语料库以增加文本的多样性。WebText&#xff1a;文章采用了类似GPT-2中的WebText文档收集清洗方…