Maven没有解决来自私人仓库

时间:2015-12-30 05:07:23

标签: java maven m2eclipse

我有关于maven的问题。我只使用m2e和eclipse火星,maven版本是3.3.3。它无法解决我的nexus私有存储库的间接依赖关系。

例如,有3个项目:common-A,common-B,biz-X。

  • common-A和common-B都部署在nexus private repo中作为jar。
  • common-B取决于common-A。 biz-X取决于common-B。因此biz-X间接取决于common-A。
  • biz-X项目确实成功下载了common-B。

问题是,biz-X无法下载common-A.jar。

任何人都可以帮助我! THX!

UPDATE1:

我有一些进步,这是m2e&#39的堆栈跟踪:

org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for (my groupId):common-B:jar:0.0.1-SNAPSHOT
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:349)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172)
at org.apache.maven.project.DefaultProjectBuilder.resolveDependencies(DefaultProjectBuilder.java:215)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:188)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:119)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.readMavenProject(MavenImpl.java:636)
at org.eclipse.m2e.core.internal.project.registry.DefaultMavenDependencyResolver.resolveProjectDependencies(DefaultMavenDependencyResolver.java:63)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:529)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:491)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:495)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:350)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:297)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:398)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:345)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1351)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:342)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact (my groupId):root:pom:0.0.1-SNAPSHOT in public (http://192.168.1.35:8081/nexus/content/repositories/central)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:177)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:226)
at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:978)
at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:796)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:325)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:340)
... 33 moreCaused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact (my groupId):root:pom:0.0.1-SNAPSHOT in public (http://192.168.1.35:8081/nexus/content/repositories/central)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:173)
... 38 moreCaused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact (my groupId):root:pom:0.0.1-SNAPSHOT in public (http://192.168.1.35:8081/nexus/content/repositories/central)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:893)
at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
at io.takari.aether.connector.AetherRepositoryConnector$GetTask.flush(AetherRepositoryConnector.java:673)
at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:310)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 41 more

似乎maven说她无法阅读普通B的pom文件。但我发现下载的common-B.jar中包含一个pom.xml,位置是:

  

/ META-INF / maven /(某些包)/common-B/pom.xml

它实际上是我在项目common-B的根目录中定义的pom。 但为什么maven不加载呢? 或者,如果这个pom文件不是maven需要的? 或者如果pom文件需要从私人仓库下载?如果是的话,我已经找到了共同的-B-0.0.1-yyyyMMdd。(可能是它的一些seq).pom在正确的nexus repo dir,maven cound'中的jar文件的相同位置。加载吗?是因为我将工件部署为SNAPSHOT类型? 或者我是否需要围绕" mvn deploy"运算?

以上是线索。希望他们有用。

UPDATE2:

哦,我的......我一定是在开玩笑吧。我找到了原因。因为有一个我忘记部署的根pom,两个常见的工件都扩展了它。现在问题解决了。谢谢你们!

1 个答案:

答案 0 :(得分:0)

您需要将Release存储库URL和SNAPSHOT存储库URL添加到pom.xml(或)settings.xml

请尝试添加链接中指定的两个网址:
Adding Snapshot Repo to pom.xml