There is a package on the Nexus private server but cannot be downloaded Could not find artifact

Problem Description

I encountered this problem during the process of learning Nexus, and then Nexus was installed on the local computer.

The project error is as follows:

insert image description here

There is nothing wrong with maven configuration

insert image description here

There is indeed the jar package in nexus, which is strange.

insert image description here

problem solved

<mirror>In fact, there is a problem with the configuration. Many tutorials on the Internet let you configure tags in maven . In fact, it is not possible to configure him at all. Configure the following configuration in maven's setting.xml to download:

<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>       

Guess you like

Origin blog.csdn.net/weixin_43888891/article/details/130899063