天天看點

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

本問僅為個人留存,是以文筆排版一般,望各位見諒哈。