我们最近建立了自己的私有Nexus存储库,但似乎无法下载jar文件。
我的pom看起来像这样
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>TestMvn</artifactId>
<version>1.0-SNAPSHOT</version>
<distributionManagement>
<repository>
<id>LB-RELEASE</id>
<url>http://IP:8081/repository/data-RELEASE/</url>
</repository>
<snapshotRepository>
<id>LB-SNAPSHOT</id>
<url>http://IP:8081/repository/data-SNAPSHOT/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>my.groupId</groupId>
<artifactId>my_artifact</artifactId>
<version>1.0.1-RELEASE</version>
</dependency>
</dependencies>
这是在我的.m2 / settings.xml文件中
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>LB-RELEASE</id>
<username>xxx</username>
<password>xx</password>
</server>
<server>
<id>LB-SNAPSHOT</id>
<username>xxx</username>
<password>xx</password>
</server>
</servers>
</settings>
因此,当我运行mvn clean install -U
时,我得到了
Failed to execute goal on project TestMvn: Could not resolve dependencies for project org.example:TestMvn:jar:1.0-SNAPSHOT: Could not find artifact my.groupId:my_artifact:jar:1.0.1-RELEASE in central (https://repo.maven.apache.org/maven2)
因此,看来maven没有连接到我们的私人仓库。
奇怪的是,它确实在m2下创建了适当的文件夹,但是只有2个文件
my_artifact-1.0.1-RELEASE.jar
和my_artifact-1.0.1-RELEASE.pom
。
只需提一下,我在Eclipse和InteliJ上都使用Eclipse mvn和终端命令进行了尝试
为什么会这样?谢谢