maven的相关操作及常见问题
mvn本地服务nexus3的搭建
下载
- 下载nexus
- 官网速度极慢,下面是我下好上传的大家可以下载使用链接:https://pan.baidu.com/s/1Ji5Orv3moXc60HRQ39y65Q
提取码:jiwx
安装
- 以管理员身份运行cmd 并切换到bin目录下面执行下面的命令安装服务
nexus.exe /install <optional-service-name> //安装nexus服务
- 启动服务
nexus.exe /start <optional-service-name> //启动nexus服务
nexus.exe /stop <optional-service-name> //停止nexus服务
其它
- 如果要更改配置信息到etc\nexus-default.properties文件中更改
application-host : Nexus服务监听的主机 ;
application-port: Nexus服务监听的端口;
nexus-context-path : Nexus服务的上下文路径;
- 默认的用户名为admin 密码为admin123
配置本地代理
- 我们要在pom.xml文件中配置,因为pom文件的依赖性主要还是maven的依赖性所以我们只要在最顶层配置即可
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.15.13:6689/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.15.13:6689/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://192.168.15.13:6689/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>3rdParty</id>
<name>3rdParty</name>
<url>http://192.168.15.13:6689/repository/3rdParty/</url>
</repository>
<repository>
<id>aliyun-repos</id>
<name>Aliyun Repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>sonatype-repos</id>
<name>Sonatype Repository</name>
<url>https://oss.sonatype.org/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>sonatype-repos-s</id>
<name>Sonatype Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Plugin Repository</name>
<url>http://192.168.15.13:6689/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>aliyun-repos</id>
<name>Aliyun Repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
mvn发布到第三方库
- 我们执行发布命令
mvn clean deploy
错误类别及处理
- 错误400 就是仓库的权限问题如下图设置为allow redeploy
- 错误401 就是setting.xml用户名密码或者仓库坐标不匹配,一一对应上即可
- 错误405 就是pom文件中的代理配置和发布配置路径不正确 参考上面的pom文件内容
- No goals have been specified for this build
<defaultGoal>compile</defaultGoal>
pom.xml文件<build>标签后面加上<defaultGoal>compile</defaultGoal>即可
mvn新建第三方库并上传本地jar文件
新建第三方仓库
- 登录nexus点击仓库,右上角新增加或者是加号
- 命令并设置权限
- 在本地Setting.xml文件中配置server同上
- 在本地jar文件夹执行下面的命令
mvn deploy:deploy-file -DgroupId=xxx.xxx -DartifactId=xxx -Dversion=0.0.2 -Dpackaging=jar -Dfile=D:\xxx.jar -Durl=http://xxx.xxx.xxx.xxx:8081/repository/3rdParty/ -DrepositoryId=3rdParty
其中-DgroupId 为上传的jar的groupId
-DartifactId 为上传的jar的artifactId
-Dversion 为上传的jar的需要被依赖的时候的版本号
然后是-Dpackaging为jar,-Dfile为jar包路径
-Durl 为要上传的路径,可以通过以下方式获取到
mvn deploy:deploy-file -DgroupId=edu.ucar -DartifactId=grib -Dversion=4.3.19 -Dpackaging=jar -Dfile=F:\my3djar\grib-4.3.19.jar -Durl=http://192.168.15.13:6689/repository/3rdParty/ -DrepositoryId=3rdParty
- 最后在pom文件是配置这个第三库的代理
mvn依赖报红线不影响正常使用解决办法
本地仓库有这个jar文件,但是还是报错,操作如下
- 把pom.xml文件是报错的依赖删除,更新maven并clean一下
- 再把报错的依赖还原,更新maven (俗称手动更新依赖)
maven的相关操作及常见问题的更多相关文章
- C# 操作 Excel 常见问题收集和整理
C# 操作 Excel 常见问题收集和整理(定期更新,欢迎交流) 经常会有项目需要把表格导出为 Excel 文件,或者是导入一份 Excel 来操作,那么如何在 C# 中操作 Excel 文件成了一个 ...
- MAC 相关操作解析
MAC 相关操作解析 OS 显示桌面 f11 F1~F12 fn + F1~F12 撤销重做 command + z command + shift + z 图片预览 选择图片 空格 上下左右 svn ...
- 利用JAVA API远程进行HDFS的相关操作
学习HDFS有一段时间了,现在把自己总结的HDFS的相关操作代码展示给大家. 主要有HDFS的增删改查,文件的追加,windows本地文件的上传,hdfs文件的下载,文件重命名,创建目录,文件是否存在 ...
- Phoenix简介概述,Phoenix的Java API 相关操作优秀案例
Phoenix简介概述,Phoenix的Java API 相关操作优秀案例 一.Phoenix概述简介 二.Phoenix实例一:Java API操作 2.1 phoenix.properties 2 ...
- 从零自学Hadoop(20):HBase数据模型相关操作上
阅读目录 序 介绍 命名空间 表 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 ...
- 从零自学Hadoop(21):HBase数据模型相关操作下
阅读目录 序 变量 数据模型操作 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 ...
- 理解CSV文件以及ABAP中的相关操作
在很多ABAP开发中,我们使用CSV文件,有时候,关于CSV文件本身的一些问题使人迷惑.它仅仅是一种被逗号分割的文本文档吗? 让我们先来看看接下来可能要处理的几个相关组件的词汇的语义. Separat ...
- Liunx下的有关于tomcat的相关操作 && Liunx 常用指令
先记录以下liunx下的有关于tomcat的相关操作 查看tomcat进程: ps-ef|grep java (回车) 停止tomcat进程: kill -9 PID (进程号如77447) (回车) ...
- pip的相关操作
>Python中的pip是什么?能够做些什么? pip是Python中的一个进行包管理的东西,能够下载包.安装包.卸载包......一些列操作 >怎么查看pip的相关信息 在控制台输入: ...
随机推荐
- JavaScript之时间对象Date
时间是物理学七大常量之一.生活中记录时间有两种方式(或者说有两种计时系统):GMT(格林尼治时间)和UTC(协调世界时间). 一 创建Date对象 JS中的Date对象只能通过new关键字创建. va ...
- spring与logstash整合,并将数据传输到Elasticsearch
logstash是一个开源的数据收集引擎,支持各种输入选择,能够同时从多个来源采集数据,将数据转发到想存储的“库”中,例如,可以转发存储到Elasticsearch,也可以转发到kafka等消息中间件 ...
- Spring boot集成Rabbit MQ使用初体验
Spring boot集成Rabbit MQ使用初体验 1.rabbit mq基本特性 首先介绍一下rabbitMQ的几个特性 Asynchronous Messaging Supports mult ...
- vue-router路由元信息及keep-alive组件级缓存
路由元信息?(黑人问号脸???)是不是这么官方的解释很多人都会一脸懵?那么我们说meta,是不是很多人恍然大悟,因为在项目中用到或者看到过呢? 是的,路由元信息就是我们定义路由时配置的meta字段:那 ...
- Spring boot 梳理 -@SpringBootApplication、@EnableAutoConfiguration与(@EnableWebMVC、WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter)
@EnableWebMvc=继承DelegatingWebMvcConfiguration=继承WebMvcConfigurationSupport 直接看源码,@EnableWebMvc实际上引入一 ...
- 一个低级错误引发Netty编码解码中文异常
前言 最近在调研Netty的使用,在编写编码解码模块的时候遇到了一个中文字符串编码和解码异常的情况,后来发现是笔者犯了个低级错误.这里做一个小小的回顾. 错误重现 在设计Netty的自定义协议的时候, ...
- 浏览器端获取短信验证码java实现——阿里云短信服务
需求:浏览器端输入手机号,获取验证码.点击登录,验证验证码是否输入错误.是否超时等情况,一旦校验通过,将用户数据保存到数据中(业务逻辑). 前提:注册阿里用户,开通短信服务,申请key.秘钥.签名.短 ...
- 如何搭建基于Docker的gitlab服务器集成CI/CD实现DEVOPS(完整版)
From this lesson you will learn about 1,How to install and configure a docker based gitlab server 2, ...
- <反向传播(backprop)>梯度下降法gradient descent的发展历史与各版本
梯度下降法作为一种反向传播算法最早在上世纪由geoffrey hinton等人提出并被广泛接受.最早GD由很多研究团队各自发表,可他们大多无人问津,而hinton做的研究完整表述了GD方法,同时hin ...
- 自适应布局display:-webkit-box的用法
在web布局中,我们经常使用的是display:inline-block,display:flex,这些,但其实在进行移动端设备自适应布局中,-webkit-box布局更加合适 不同的浏览器有不同的前 ...