不可解析的父POM,尽管relativePath设置为现有父pom.xml

时间:2017-01-09 02:14:31

标签: maven

我的项目有结构

pom.xml  (parent)
tcp/pom.xml
spark/pom.xml

模块xmls'都包含这个模糊

<parent>
  <groupId>org.myorg</groupId>
  <artifactId>parent</artifactId>
  <version>1.0</version>
  <relativePath>../pom.xml</relativePath>
</parent>

我也尝试将relativePath留空,或../..,甚至根本不包括[ERROR] The build could not read 2 projects -> [Help 1] [ERROR] [ERROR] The project org.myorg:tcpclient:1.0.0 (/git/MYorg/tcp/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for org.myorg:tcpclient:1.0.0: Failure to find org.myorg:parent:pom:1.0 in https://repository.apache.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of Maven snapshots repository has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 24, column 9 -> [Help 2] 。在所有情况下,结果是:

mvn clean install -U  -X > out 2>&1


INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.3.9/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/steve/.m2/settings.xml
[DEBUG] Reading global toolchains from /usr/local/Cellar/maven/3.3.9/libexec/conf/toolchains.xml
[DEBUG] Reading user toolchains from /Users/steve/.m2/toolchains.xml
[DEBUG] Using local repository at /Users/steve/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/steve/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/content/repositories/snapshots
Downloading: https://repository.apache.org/content/repositories/snapshots/org/openchai/parent/1.0/parent-1.0.pom

[DEBUG] Writing tracking file /Users/steve/.m2/repository/org/openchai/parent/1.0/parent-1.0.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
Downloading: https://repo.maven.apache.org/maven2/org/openchai/parent/1.0/parent-1.0.pom

[DEBUG] Writing tracking file /Users/steve/.m2/repository/org/openchai/parent/1.0/parent-1.0.pom.lastUpdated
[DEBUG] Skipped remote request for org.openchai:parent:pom:1.0, already updated during this session.
[DEBUG] Extension realms for project org.openchai:parent:pom:1.0.0: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-jar-plugin @ line 223, column 21
[FATAL] Non-resolvable parent POM for org.openchai:tcpclient:1.0.0: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots) and 'parent.relativePath' points at wrong local POM @ line 24, column 9
[FATAL] Non-resolvable parent POM for org.openchai:spark_p2prdd:1.0.0: Failure to find org.openchai:parent:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 24, column 10
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-install-plugin is missing. @ line 90, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 168, column 15
 @ 
[ERROR] The build could not read 2 projects -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-jar-plugin @ line 223, column 21
[FATAL] Non-resolvable parent POM for org.openchai:tcpclient:1.0.0: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots) and 'parent.relativePath' points at wrong local POM @ line 24, column 9
[FATAL] Non-resolvable parent POM for org.openchai:spark_p2prdd:1.0.0: Failure to find org.openchai:parent:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 24, column 10
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-install-plugin is missing. @ line 90, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 168, column 15

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
    at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
    at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]   
[ERROR]   The project org.openchai:tcpclient:1.0.0 (/git/OCspark/tcp/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.openchai:tcpclient:1.0.0: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots) and 'parent.relativePath' points at wrong local POM @ line 24, column 9 -> [Help 2]
org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:197)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:246)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1000)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:800)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:329)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:555)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
    at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
    at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots)
    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.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:193)
    ... 27 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.openchai:parent:pom:1.0 in Maven snapshots repository (https://repository.apache.org/content/repositories/snapshots)
    at org.eclipse.aether.

所以我可以通过这些多模块构建来使用一些帮助。

更新以下是

输出的最后一部分
if auth.info.image.present?

3 个答案:

答案 0 :(得分:2)

在跟踪我的许多细节时我犯了以下错误:

父版本列为1.0。父pom.xml中的实际版本为1.0.0

我没有概念误解:只关注细节。

答案 1 :(得分:2)

我刚刚看到了poms中的版本差异。 1.0.0和1.0。校验? 哦,你更新了相同:))

答案 2 :(得分:0)

对此的主要答案应该是When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified? 我猜你可能在某个阶段构建项目时尝试了一个不正确的relativePath,并尝试生成工件并失败但现在pom.xml缓存了一个不正确的relativePath并且会继续抛出错误。

如果您根本不想删除存储库,还建议您通过this answer How do you clear Apache Maven's cache?使用有效的方式清除缓存

有关<relativePath>的更多信息,并且正在使用 -

  

父&lt; code&gt; pom.xml&lt; / code&gt;的相对路径文件   在结账时。

     

默认值为../pom.xml

     

Maven首先在当前构建项目的反应堆中查找父pom,然后在文件系统上的此位置查找本地存储库,最后在远程仓库中查找。

     

&LT;代码&GT; relativePath&LT; /代码&GT;允许您选择不同的位置,例如,当您的结构是平的时,或者更深,没有中间父pom。

     

但是,仍然需要组ID,工件ID和版本,   并且必须与给定位置的文件匹配,否则它将恢复为POM的存储库。

     

此功能仅用于增强该项目本地结帐的开发。

在您的情况下,问题描述的结构不需要显式定义relativePath,并且可以使用其默认值来跳过其声明。