天天看点

mvn deploy 上传项目到maven私服失败 400 Bad Request

自己搭建过程中出现的问题,废话不说,直入主题。  首先确认 你自己的相关配置 是否正确。  如下图

<!--注意限定版本一定为RELEASE,因为上传的对应仓库的存储类型为RELEASE -->
	<!--指定仓库地址 -->
	<distributionManagement>
		<repository>
			<!--此名称要和.m2/settings.xml中设置的ID一致 -->
			<id>mayikt</id>
			<url>http://192.168.212.230:8081/repository/mayikt-release/</url>
		</repository>
	</distributionManagement>

	<build>
		<plugins>
			<!--发布代码Jar插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.7</version>
			</plugin>
			<!--发布源码插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.2.1</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

           

在项目的pom.xml中要有这些配置。   配置的参数不要配错了。

我的问题是 pom的version 没有配置, 是项目自动生成的 如图

mvn deploy 上传项目到maven私服失败 400 Bad Request

由于我的仓库设置的存储类型为release的, 所以无法成功上传,最后把version改成了release, 如图

mvn deploy 上传项目到maven私服失败 400 Bad Request

再执行命令  成功了~~

mvn deploy 上传项目到maven私服失败 400 Bad Request

本问仅为个人留存,所以文笔排版一般,望各位见谅哈。