前言

项目构建管理工具

安装

conf/settings.xml:

<localRepository>D:\develop\apache-maven-3.5.2\repository</localRepository>
  • Maven环境变量

系统变量新建: MAVEN_HOME:D:\develop\apache-maven-3.5.2

path添加: %MAVEN_HOME%\bin

  • 测试安装
mvn -v

配置镜像

有shadowsocks就不要配置!!!,有可能冲突。

setting.xml

<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>

idea配置Maven

  • 普通配置

    • File --->settings --->搜索maven --->指定maven目录,配置文件路径, 本地仓库路径
  • 默认配置:

    • File--->other setting --->Default Settings --->搜索Maven --->指定maven目录 ,配置文件路径 , 本地仓库路径
    • File--->other setting --->Default Settings --->搜索Maven --->Maven下的Runner--->设置VM options为:-DarchetypeCatalog=internal
  • 设置自动修改包:

    在 build-build-maven-importing里面设置自动引用

私服

安装到centos

wget https://sonatype-download.global.ssl.fastly.net/nexus/3/latest-unix.tar.gz
tar -zxvf latest-unix.tar.gz -C /usr/local/ # 启动 &表示后台
/usr/local/nexus-3.13.0-01/bin/nexus run &

访问

http://localhost:8081/nexus/

用户名:admin

密码:admin123

客户端配置私服

maven安装目录下的setting.xml添加:

<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
<profile>
<!--profile 的 id-->
<id>dev</id>
<repositories>
<repository>
<!--仓库 id, repositories 可以配置多个仓库,保证 id 不重复-->
<id>nexus</id>
<!--仓库地址,即 nexus 仓库组的地址-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!--是否下载 releases 构件-->
<releases>
<enabled>true</enabled>
</releases>
<!--是否下载 snapshots 构件-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- 插件仓库, maven 的运行依赖插件,也需要从私服下载插件 -->
<pluginRepository>
<!-- 插件仓库的 id 不允许重复,如果重复后边配置会覆盖前边 -->
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
<!--激活-->
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>

idea修改指定pom

<!--发布管理节点,指定当前项目上传的仓库url地址-->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository> </distributionManagement>

项目发布到私服

deploy

jar包会自动从私服下载

从客户端导入第三方jar包

在jar包位置cmd

mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37
-Dfile= fastjson-1.1.37.jar -Dpackaging=jar

maven-windows使用的更多相关文章

  1. Spark+ECLIPSE+JAVA+MAVEN windows开发环境搭建及入门实例【附详细代码】

    http://blog.csdn.net/xiefu5hh/article/details/51707529 Spark+ECLIPSE+JAVA+MAVEN windows开发环境搭建及入门实例[附 ...

  2. Maven—Windows操作系统中安装配置Maven环境

    今天难得的周末,借此难的机会总结一下关于maven的一些操作: 1.在安装maven之前要确认计算机已经安装并配置了JDK. 2.下载maven: maven-3.0.3:http://downloa ...

  3. maven windows 环境变量

    MAVEN_HOME,内容是解压的maven文件路径 Path中添加 %MAVEN_HOME%\bin 为了测试安装成功,打开命令提示符,输入 mvn -version

  4. maven windows环境nexus3.0私服搭建

    下载 nexus3.x.x 需要JDK1.8版本到sonatype官网下载开源免费的OSS版本,OSS即为Open Source Software.下载地址:https://www.sonatype. ...

  5. MyEclipse自带maven找不到或自己外置安装

    我用的MyEclipse2015 stable2.0版本. 1.删除相关SoftwareHelp --> choose components --> 进入后点 已安装的maven选项. 由 ...

  6. Maven环境变量配置和在Eclipse中的配置

    1.Maven环境变量配置 M2_HOME :变量值为maven的安装目录 在path后添加%M2_HOME%\bin; 检查JDK,maven配置的cmd命令 echo %JAVA_HOME% ja ...

  7. Windows&Linux常用命令笔记

    目录 linux windows Linux: 1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件. find . -name &qu ...

  8. maven课程 项目管理利器-maven 5-1 课程总结 1星(2018-11-08 07:19)

    1 maven windows环境搭建和配置环境变量 2 maven骨架和pom.xml 解析 3 命令行窗口常用的maven命令 4 仓库和坐标 5 maven Java项目 6 生命周期,依赖聚合 ...

  9. 1 Maven简介

    一.构建(build)     清理.编译.测试.打包.部署等一系列操作. 二.maven介绍:     maven是一个强大的构建工具,能够帮助我们自动化构建过程:从清理(clean).编译(com ...

  10. Spring Boot(十)Logback和Log4j2集成与日志发展史

    一.简介 Java知名的日志有很多,比如:JUL.Log4j.JCL.SLF4J.Logback.Log4j2,那么这些日志框架之间有着怎样的关系?诞生的原因又是解决什么问题?下面一起来看. 1.1 ...

随机推荐

  1. 不依赖JQuery的入门Ajax代码

    今天看了head first ajax这本书里ajax的实例,讲的很好,这本书觉着很不错,推荐下. Ajax (Asynchronous Javascript and XML)即异步Javascrip ...

  2. (转)rsync+inotify实时同步

    原文:http://lxw66.blog.51cto.com/5547576/1331048 声明:rsync inotify 需要逆向思考,当只做rsync不实时同步时,我们一般是从rsync服务端 ...

  3. Node.js环境搭建&&npm安装

    Node.js环境搭建 什么使Node.js呢?我们知道JavaScript开始作为客户端语言,但早已在浏览器端一统江湖,这时,野心越来越大,它就想向服务器端拓展了,于是Node.js就是这样的,我们 ...

  4. IDE神器intellij idea的基本使用 (转载)

    一.关于新建工程,导入工程,配置jdk,tomcat这里不做过多的讲述,必定网络上关于此类配置一堆一堆的. 二.编码快捷键(比较常用的快捷键)该套快捷键选择的是:Mac OS X 10.5+ 1. a ...

  5. MySQL 备份数据库

    一.数据备份 1.备份一个数据库 mysqldump基本语法: mysqldump -u username -p dbname table1 table2 ...-> BackupName.sq ...

  6. hibernate关联关系的crud之级联

    cascade级联,只会影响CRUD的CUD,不会影响读取.不设置级联,从多的一方能读出一的一方,设了级联,从一的一方,默认也不能读出多的一方. 如果两个对象之间有关联,不管是一对多,多对一,单向还是 ...

  7. Editplus下载、安装并最佳配色方案(强烈推荐)

    不多说,直接上干货! Editplus下载 第一步:进入官网 https://www.editplus.com/ 第二步:下载 https://www.editplus.com/download.ht ...

  8. 翻译:WebAssembly简介:我们为什么要关心这个技术? ​​​​

    原文: https://tomassetti.me/introduction-to-webassembly/ WebAssembly简介:我们为什么要关心这个技术? ​​​​ 在对抗js的伟大战斗中有 ...

  9. [中英对照]INTEL与AT&T汇编语法对比

    本文首先对文章Intel and AT&T Syntax做一个中英文对照翻译,然后给出一个简单的例子,再用gdb反汇编后,对INTEL与AT&T的汇编语法进行对照从而加深理解. Int ...

  10. String类的substring方法

    下列程序的输出是什么? class A { public static void main(String[] a) {     String v = “base”;      v.concat(“ba ...