mave 入门配置,速学笔记

2023-12-21 01:40
文章标签 配置 入门 笔记 速学 mave

本文主要是介绍mave 入门配置,速学笔记,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

  以window系统为例进行讲解:

一、安装mave

1、下载mave压缩包,并解压;下载地址:http://maven.apache.org/download.cgi

2、添加系统环境变量,名称:MAVE_HOME  内容为:mave解压后的地址如 D:\JavaApps\apache-maven-3.3.9

     注意,解压后的路径不要带有中文字符!

3、设置系统环境变量Path,追加 %MAVE_HOME%\bin (此处不明白的自行百度。)

4、打开cmd,执行 mvn -v,有输出mave的相关信息,则安装成功。

二、mave简单设置说明。

mave需要设置远程仓库地址和本地仓库地址,目前大部分公司都会部署自己的mave私服,因此远程仓库地址需配置公司的私服地址,其次配置阿里的代理仓库地址,最后则使用默认的中央仓库地址;本地仓库地址默认是再系统盘中,建议修改该配置。

1、配置文件在conf中,如:D:\JavaApps\apache-maven-3.3.9\conf 。

2、配置文件为settings.xml。

3、找到 localRepository 标签,并填写本地仓库地址如下:

<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>d:\mvn</localRepository>

4、找到  mirror 标签,并填写 公司私服地址如:

  <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>nexus</id><mirrorOf>central</mirrorOf><url>http://192.168.2.144:8081/nexus/content/groups/public/</url></mirror>    </mirrors>

5、如果需要使用 deploy 命令打包到私服(此处为nexus搭建的私服,用户名为:myuser,密码为:123456),需做如下配置:

<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>--><server><id>my-nexus-releases</id><username>myuser</username><password>123456</password></server><server><id>my-nexus-snapshots</id><username>myuser</username><password>123456</password></server></servers>

且具体项目的pom文件需做配置:

<distributionManagement><snapshotRepository><id>snapshots</id><name>maven-snapshots</name><url>http://192.168.2.144:8081/nexus/context/repository/snapshots/</url></snapshotRepository>
</distributionManagement>

6、其余配置内容和说明,请自行查看文档注释,以及相关资料。

 

这篇关于mave 入门配置,速学笔记的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/518252

相关文章

Spring配置扩展之JavaConfig的使用小结

《Spring配置扩展之JavaConfig的使用小结》JavaConfig是Spring框架中基于纯Java代码的配置方式,用于替代传统的XML配置,通过注解(如@Bean)定义Spring容器的组... 目录JavaConfig 的概念什么是JavaConfig?为什么使用 JavaConfig?Jav

Spring Boot Interceptor的原理、配置、顺序控制及与Filter的关键区别对比分析

《SpringBootInterceptor的原理、配置、顺序控制及与Filter的关键区别对比分析》本文主要介绍了SpringBoot中的拦截器(Interceptor)及其与过滤器(Filt... 目录前言一、核心功能二、拦截器的实现2.1 定义自定义拦截器2.2 注册拦截器三、多拦截器的执行顺序四、过

springboot的controller中如何获取applicatim.yml的配置值

《springboot的controller中如何获取applicatim.yml的配置值》本文介绍了在SpringBoot的Controller中获取application.yml配置值的四种方式,... 目录1. 使用@Value注解(最常用)application.yml 配置Controller 中

springboot中配置logback-spring.xml的方法

《springboot中配置logback-spring.xml的方法》文章介绍了如何在SpringBoot项目中配置logback-spring.xml文件来进行日志管理,包括如何定义日志输出方式、... 目录一、在src/main/resources目录下,也就是在classpath路径下创建logba

C++多线程开发环境配置方法

《C++多线程开发环境配置方法》文章详细介绍了如何在Windows上安装MinGW-w64和VSCode,并配置环境变量和编译任务,使用VSCode创建一个C++多线程测试项目,并通过配置tasks.... 目录下载安装 MinGW-w64下载安装VS code创建测试项目配置编译任务创建 tasks.js

Nginx概念、架构、配置与虚拟主机实战操作指南

《Nginx概念、架构、配置与虚拟主机实战操作指南》Nginx是一个高性能的HTTP服务器、反向代理服务器、负载均衡器和IMAP/POP3/SMTP代理服务器,它支持高并发连接,资源占用低,功能全面且... 目录Nginx 深度解析:概念、架构、配置与虚拟主机实战一、Nginx 的概念二、Nginx 的特点

SpringCloud Stream 快速入门实例教程

《SpringCloudStream快速入门实例教程》本文介绍了SpringCloudStream(SCS)组件在分布式系统中的作用,以及如何集成到SpringBoot项目中,通过SCS,可... 目录1.SCS 组件的出现的背景和作用2.SCS 集成srping Boot项目3.Yml 配置4.Sprin

2025最新版Android Studio安装及组件配置教程(SDK、JDK、Gradle)

《2025最新版AndroidStudio安装及组件配置教程(SDK、JDK、Gradle)》:本文主要介绍2025最新版AndroidStudio安装及组件配置(SDK、JDK、Gradle... 目录原生 android 简介Android Studio必备组件一、Android Studio安装二、A

前端Visual Studio Code安装配置教程之下载、汉化、常用组件及基本操作

《前端VisualStudioCode安装配置教程之下载、汉化、常用组件及基本操作》VisualStudioCode是微软推出的一个强大的代码编辑器,功能强大,操作简单便捷,还有着良好的用户界面,... 目录一、Visual Studio Code下载二、汉化三、常用组件1、Auto Rename Tag2

SpringBoot18 redis的配置方法

《SpringBoot18redis的配置方法》本文介绍在SpringBoot项目中集成和使用Redis的方法,包括添加依赖、配置文件、自定义序列化方式、使用方式、实际使用示例、常见操作总结以及注意... 目录一、Spring Boot 中使用 Redis1. 添加依赖2. 配置文件3. Redis 配置类