Nexus私服上有包却无法下载Could not find artifact

问题描述

我是在学习Nexus过程当中产生的该问题,然后Nexus是安装在了本地电脑。

项目报错如下:

在这里插入图片描述

maven配置的也没毛病呀

在这里插入图片描述

nexus当中也的确有该jar包呀,这就奇怪了。

在这里插入图片描述

问题解决

其实是配置有问题的,网上很多教程都是让你在maven当中配置<mirror>标签,实际上配置他根本就不行。在maven的setting.xml配置如下配置即可下载:

<servers>
  <!-- 这是配置访问私有仓库的用户名密码 -->
  <server>
    <!-- id标签可以随便填,只需要在servers中唯一即可,后面很多地方会使用该id -->
    <id>self-maven</id>
    <username>deplyment</username>
    <password>deplyment123</password>
  </server>
</servers>
<profiles>
	<profile>
        <id>nexus</id>
        <!--声明一个或多个远程仓库  -->
		<repositories>
			<!-- 声明一个 Nexus 私服上的仓库  -->
			<repository>
				<!--仓库id,这个id就是上面配置的账号密码id  -->
				<id>self-maven</id>
				<!-- 仓库的名称 -->
				<name>nexus</name>
				<!--仓库的地址  -->
				<url>http://localhost:8081/repository/maven-public/</url>
				<!-- 是否开启该仓库的 release 版本下载支持 -->
				<releases>
					<enabled>true</enabled>
				</releases>
				<!-- 是否开启该仓库的 snapshot 版本下载支持 -->
				<snapshots>
					<enabled>true</enabled>
				</snapshots>
			</repository>
		</repositories>
		<!-- 声明一个或多个远程插件仓库 -->
		<pluginRepositories>
			<!--声明一个 Nexus 私服上的插件仓库  -->
			<pluginRepository>
				<!--插件仓库 id -->
				<id>self-maven</id>
				<!--插件仓库 名称 -->
				<name>nexus</name>
				<!-- 配置的插件仓库的地址 -->
				<url>http://localhost:8081/repository/maven-public/</url>
				<!-- 是否开启该插件仓库的 release 版本下载支持 -->
				<releases>
					<enabled>true</enabled>
				</releases>
				<!-- 是否开启该插件仓库的 snapshot 版本下载支持 -->
				<snapshots>
					<enabled>true</enabled>
				</snapshots>
			</pluginRepository>
		</pluginRepositories>
          <properties>
              <maven.compiler.source>1.8</maven.compiler.source>
              <maven.compiler.target>1.8</maven.compiler.target>
              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
          </properties>
	<!-- 默认该profile生效 -->
          <activation>
              <activeByDefault>true</activeByDefault>
          </activation>
      </profile>
</profiles>       

猜你喜欢

转载自blog.csdn.net/weixin_43888891/article/details/130899063