maven私服上传jar包 400 Bad Request 错误

文章目录

  • 前言
  • 一、直接看报错
  • 二、问题处理
  • 三 maven 私服配置说明
  • 总结


前言

maven仓库的私服,一般会存放公司或者个人封装的jar包,用来共享给二次开发和协作伙伴用,很方便


第一次发布没有问题,但是我第二次发布,开始报错了

一、直接看报错

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-BGqiXGIe-1721546348045)(https://i-blog.csdnimg.cn/direct/b15cc2dd57d54870849827891438d7c4.png)]

  1. 401 无权限
  2. 我这个是400 说明用户名密码是对的

二、问题处理

其实很简单,这个错误是因为我没有开启,已经存在的jar 可以覆盖推送

  1. 登录私服 用户名密码
  2. 选择左侧 Repositories
  3. 选中要推送的仓库地址的 Repositories
  4. 修改Configuration配置 Deployment Policy 默认为 Disable Redeploy 改为 Allow Redeploy
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kfefPzlt-1721546348050)(https://i-blog.csdnimg.cn/direct/ddd73175ec6b4ae48b1bdaae8a921839.png)]

三 maven 私服配置说明

  1. 有了maven私服,先配置自己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.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.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:\JAVA\apache-maven-3.9.3\repo</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><!-- TODO Since when can proxies be selected as depicted? --><!-- 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>--><server><id>activeId</id><username>用户名</username><password>密码</password></server><server><id>Releases</id><username>用户名</username><password>密码</password></server><server><id>Snapshots</id><username>用户名</username><password>密码</password></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><mirrorOf>local</mirrorOf><name>localmaven</name><id>thirdparty</id><url>http://192.168.1.115:8081/nexus/content/repositories/thirdparty/</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>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</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 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>activeId</id><repositories><repository><id>central</id><name>MyRepository</name><url>http://ip:端口/nexus/content/repositories</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>thirdparty</id><url>http://ip:端口/nexus/content/repositories/thirdparty/</url></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://ip:端口/nexus/content/repositories</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>--><activeProfiles><activeProfile>activeId</activeProfile></activeProfiles>
</settings>
  1. 要推送jar ,应该在项目的pom中配置 私服地址
<distributionManagement><repository><id>Releases</id><url>http://ip:端口/nexus/content/repositories/releases</url></repository><snapshotRepository><id>Snapshots</id><url>http://ip:端口/nexus/content/repositories/snapshots</url></snapshotRepository></distributionManagement>

然后 ,点击maven 的 deploy,就可以发布jar了
上传就行了


总结

至此,maven私服配置完毕,可以下载jar,也可以向maven私服推送jar.
也解决了,不能重复推送jar的问题

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

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

相关文章

问题解决实录 | Anaconda | Anaconda Navigator 启动无反应

问题解决实录 | Anaconda | Anaconda Navigator 启动无反应 以管理员身份运行 Anaconda Prompt conda update -n root conda conda update --all如果执行完以上步骤 碰到 AttributeError: module ‘pkgutil’ has no attribute ‘ImpImporter’. Did you mean: ‘zipimporter…

HC-SR04超声波测距模块使用方法和例程(STM32快速移植)

基于STM32和HC-SR04模块实现超声波测距功能 HC-SR04硬件概述HC-SR04超声波距离传感器的核心是两个超声波传感器。一个用作发射器&#xff0c;将电信号转换为40 KHz超声波脉冲。接收器监听发射的脉冲。如果接收到它们&#xff0c;它将产生一个输出脉冲&#xff0c;其宽度可用于…

各类专业技术的pdf电子书

从业多年&#xff0c;收集了海量的pdf电子书籍&#xff0c;感兴趣的私聊。

App Instance 架构示例

前言 在Unity程序设计过程中&#xff0c;我们处理的第一个对象是Application Instance。 它的主要职责是启动流程管理、卸载流程管理&#xff0c;次要职责是管理在内部的子系统生命周期。其他职责&#xff0c;提供或桥接应用程序的配置信息、及其他第三方接口。 它通常以单例的…

图解 Hadoop 架构 |Yarn、MapReduce

Hadoop Hadoop 是什么 Hadoop 是由 Apache 基金会所开发&#xff0c;维护的分布式系统基础架构主要解决海量数据的存储和海量数据的分析计算问题广义上来说&#xff0c;Hadoop 通常是指一个更广泛的概念——Hadoop 生态圈&#xff0c;包括 MapReduce&#xff0c;HDFS&#xf…

淼淼瀛湖水,青青枇杷林

淼淼瀛湖水&#xff0c;青青枇杷林 ——西安工程大学赴陕西安康“筑梦乡村&#xff0c;携手同行”暑期社会实践团 俗语言“五月枇杷满树金”。枇杷营养丰富&#xff0c;食用&#xff0c;具有止渴、润燥、清肺、止咳等功效。为探索枇杷产业&#xff0c;实现乡村振兴&#xff0c…

代码随想录 day 18 二叉树

第六章 二叉树part06 详细布置 530.二叉搜索树的最小绝对差 需要领悟一下二叉树遍历上双指针操作&#xff0c;优先掌握递归 题目链接/文章讲解&#xff1a;https://programmercarl.com/0530.%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E7%B…

数据结构~~顺序表

目录 一、顺序表的概念 二、顺序表的接口实现 1.顺序表初始化 2.顺序表销毁 3.检查空间并扩容 4.顺序表尾插、顺序表头插 5.顺序表尾删、顺序表头删 6.顺序表查找 7.顺序表在pos位置插入x、删除pos位置的值 三、完整代码 四、总结 一、顺序表的概念 顺序表是用一段…

SpringCloud的认识和初步搭建

目录 一.认识SpringCloud 二.SpringCloud的部署 2.1开发环境 2.2数据库的建立 2.3SpringCloud的部署 第一步&#xff1a; 创建Maven项目 第二步&#xff1a;完善pom文件 第三步&#xff1a;创建两个子项目 第四步&#xff1a;声明项目依赖以及构建插件 第五步&#xf…

cocos2d-x安装和项目

首先多方查找资料发现教程很简洁&#xff0c;发现对自己的操作方面没多大帮助&#xff0c;后来干脆去官网&#xff0c;好像也很简洁。基于这样一个原因&#xff0c;加上我首次碰cocos2d-x&#xff0c;决定记录一下整个流程&#xff0c;解决实际操作上的疑惑。 涉及的方面&…

爬虫的深度爬取

爬虫的深度爬取和爬取视频的方式 深度爬取豆瓣读书 import time import fake_useragent import requests from lxml import etree head {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 …

Docker核心技术:Docker的基本使用

云原生学习路线导航页&#xff08;持续更新中&#xff09; 本文是 Docker核心技术 系列文章&#xff1a;Docker的基本使用&#xff0c;其他文章快捷链接如下&#xff1a; 应用架构演进容器技术要解决哪些问题Docker的基本使用&#xff08;本文&#xff09;Docker是如何实现的 3…

MongoDB自学笔记(四)

一、前文回顾 上一篇文章中我们学习了MongoDB中的更新方法&#xff0c;也学了一部分操作符。今天我们将学习最后一个操作“删除”。 二、删除 原始数据如下&#xff1a; 1、deleteOne 语法&#xff1a;db.collection.deleteOne(< query >,< options >) 具体参…

【SD】 Stable Diffusion(SD)原理详解与ComfyUI使用 2

Stable Diffusion&#xff08;SD&#xff09;原理详解与ComfyUI使用 Stable Diffusion&#xff08;SD&#xff09;原理详解与ComfyUI使用1. SD整体结构2. Clip&#xff08;文本编码器&#xff09;3. Unit&#xff08;生成模型&#xff09;4. VAE&#xff08;变分自编码器&#…

Electron 结合 Selenium + chromedriver 驱动服务实现浏览器多开

背景 在调研浏览器多开的过程中&#xff0c;electron 有自带的 browserview&#xff0c;webview&#xff0c;但是上面两个受制于 electron 内核版本限制&#xff0c;升级不够灵活&#xff0c;对新版的网页支持可能不及时&#xff0c;甚至不兼容&#xff0c;必须通过发布新的客…

redis的学习(一):下载安装启动连接

简介 redis的下载&#xff0c;安装&#xff0c;启动&#xff0c;连接使用 nosql nosql&#xff0c;即非关系型数据库&#xff0c;和传统的关系型数据库的对比&#xff1a; sqlnosql数据结构结构化非结构化数据关联关联的非关联的查询方式sql查询非sql查询事务特性acidbase存…

新版SpringSecurity5.x使用与配置

目录 一、了解SpringSecurity 1.1 什么是Spring Security&#xff1f; 1.2 Spring Security功能 1.3 Spring Security原理 1.4 RABC (Role-Based Access Control) 二、SpringSecurity简单案例 2.1 引入SpringSecurity依赖 2.2 创建一个简单的Controller 三、SpringSecu…

8.持久化

队列和消息都可以持久化。 持久化的目的就是让消息不丢失。 RabbitMQ本身退出&#xff0c;或者由于某种原因崩溃时造成的消息丢失。 RabbitMQ一旦宕机&#xff0c;就会造成队列和消息都丢失了。 RabbitMQ重启之后&#xff0c;非持久化的队列和消息都不存在了。 队列持久化…

数据结构 —— B树

数据结构 —— B树 B树B树的插入操作分裂孩子分裂父亲分裂 我们之前学过了各种各样的树&#xff0c;二叉树&#xff0c;搜索二叉树&#xff0c;平衡二叉树&#xff0c;红黑树等等等等&#xff0c;其中平衡二叉树和红黑树都是控制树的高度来控制查找次数。 但是&#xff0c;这都…

C语言:数组-学习笔记(万字笔记)——翻新版

目录 前言&#xff1a; 1、 数组的概念 1.1 什么是数组 1.2 为什么学习数组&#xff1f; 2. ⼀维数组的创建和初始化 2.1 数组创建 2.2 数组的初始化 2.3 数组的类型 2.3.1 什么是数组类型&#xff1f; 2.3.2 数组类型的作用 3、 一维数组的使用 3.1 数组下标 3.2 数…