NutzCN Logo
问答 请教一个 maven 私有库的问题
发布于 1518天前 作者 shevawen 1726 次浏览 复制 上一个帖子 下一个帖子
标签:

用 nexus 建好了私有库, 上传了 artifact

Index of /repositories/snapshots/****/cms-interfaces/0.0.1-SNAPSHOT

Name	Last Modified	Size	Description
Parent Directory
cms-interfaces-0.0.1-20160825.080248-1.jar	Thu Aug 25 16:02:47 CST 2016	42113	
cms-interfaces-0.0.1-20160825.080248-1.jar.md5	Thu Aug 25 16:02:47 CST 2016	32	
cms-interfaces-0.0.1-20160825.080248-1.jar.sha1	Thu Aug 25 16:02:47 CST 2016	40	
cms-interfaces-0.0.1-20160825.080248-1.pom	Thu Aug 25 16:02:47 CST 2016	814	
cms-interfaces-0.0.1-20160825.080248-1.pom.md5	Thu Aug 25 16:02:47 CST 2016	32	
cms-interfaces-0.0.1-20160825.080248-1.pom.sha1	Thu Aug 25 16:02:47 CST 2016	40	
maven-metadata.xml	Thu Aug 25 16:02:47 CST 2016	775	
maven-metadata.xml.md5	Thu Aug 25 16:02:47 CST 2016	32	
maven-metadata.xml.sha1	Thu Aug 25 16:02:47 CST 2016	40	

但是在本地mvn缓存里并没有下到 jar,所以项目中引用也出错了。

$ ls -lht /Users/s*****n/.m2/repository/****/cms-interfaces/0.0.1-SNAPSHOT/
total 72
-rw-r--r--  1 s*****n  staff   185B  8 25 17:47 _remote.repositories
-rw-r--r--  1 s*****n  staff   814B  8 25 17:47 cms-interfaces-0.0.1-20160825.080248-1.pom
-rw-r--r--  1 s*****n  staff    32B  8 25 17:47 cms-interfaces-0.0.1-20160825.080248-1.pom.md5
-rw-r--r--  1 s*****n  staff    40B  8 25 17:47 cms-interfaces-0.0.1-20160825.080248-1.pom.sha1
-rw-r--r--  1 s*****n  staff   814B  8 25 17:47 cms-interfaces-0.0.1-SNAPSHOT.pom
-rw-r--r--  1 s*****n  staff   775B  8 25 17:47 maven-metadata-private.xml
-rw-r--r--  1 s*****n  staff    32B  8 25 17:47 maven-metadata-private.xml.md5
-rw-r--r--  1 s*****n  staff    40B  8 25 17:47 maven-metadata-private.xml.sha1
-rw-r--r--  1 s*****n  staff   186B  8 25 17:47 resolver-status.properties

请教一下哪里出了问题。

7 回复

pom里面引用私库没?

来自炫酷的 NutzCN

@wendal

引用了

	<dependencies>
	....
		<dependency>
			<groupId>*****</groupId>
			<artifactId>cms-interfaces</artifactId>
			<version>0.0.1-SNAPSHOT</version>
		</dependency>
	</dependencies>
	<repositories>
		<repository>
			<id>private</id>
			<url>http://***.***.***.***/nexus/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
Description	Resource	Path	Location	Type
ArtifactDescriptorException: Failed to read artifact descriptor for *****:cms-interfaces:jar:0.0.1-SNAPSHOT: UnresolvableModelException: Could not find artifact cn.gov.imwb:cms:pom:0.0.1-SNAPSHOT in private (http://***.***.***.***:8081/nexus/content/repositories/snapshots)	pom.xml	/cast-core	line 1	Maven Dependency Problem

@shevawen 命令行下看mvn compile日志

来自炫酷的 NutzCN

$ mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] cast
[INFO] cast-core
[INFO] cast-admin
[INFO] cast-scheduler
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cast 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cast-core 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] cast ............................................... SUCCESS [  0.002 s]
[INFO] cast-core .......................................... FAILURE [  0.391 s]
[INFO] cast-admin ......................................... SKIPPED
[INFO] cast-scheduler ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.567 s
[INFO] Finished at: 2016-08-25T18:02:51+08:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cast-core: Could not resolve dependencies for project longview.io:cast-core:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at *****:cms-interfaces:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for *****:cms-interfaces:jar:0.0.1-SNAPSHOT: Failure to find *****:cms:pom:0.0.1-SNAPSHOT in http://***.***.***.***:8081/nexus/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of private has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :cast-core

没配置强制刷新

		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
			</snapshots>
			<releases>
				<enabled>false</enabled>
			</releases>
		</repository>

添加回复
请先登陆
回到顶部