文章目录

最近在引用一个公司里其它同事写的的maven包。发现一个奇怪难受的情况,就是版本号里没有SNAPSHOT的时候,是能找到包的。但是一旦加上了SNAPSHOT就找不到包了。到maven的代理服务器里看,包又是存在的。 查了一圈才发现需要开启snapshot的配置。

这样是正常的

1
2
3
4
5
<dependency>
<groupId>com.chint.ziam</groupId>
<artifactId>chint-ziam-library</artifactId>
<version>1.0.0</version>
</dependency>

这样就找不到

1
2
3
4
5
<dependency>
<groupId>com.chint.ziam</groupId>
<artifactId>chint-ziam-library</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

后来加了repository的配置就好了 在pom.xml的根节点下加上

1
2
3
4
5
6
7
8
9
<repositories>
<repository>
<id>maven-public</id>
<url>http://xxxxx</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

关键就是让对应的repository 的 snapshots 里的 enabled 为true

文章目录