2017-01-09 93 views
0

我的項目具有結構非解析父POM雖然relativePath設置爲現有父pom.xml的

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

模塊個XML都包括這Blurb的

<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. 
+0

如果使用intelliJ,你也可以試試這個[首選項>構建,執行,部署>構建工具> Maven>導入>取消選中'自動導入Maven項目']並再次構建項目。這將避免同時在IDEA和Maven中同步模塊/項目。如果intelliJ正在緩存不正確的密鑰,則可能會工作。 – nullpointer

+1

我至少有五年的時間不受限制。 – javadba

回答

1

在一片如此多的細節來跟蹤我做了以下錯誤:

父版本被列爲1.0。父pom.xml中的實際版本是1.0.0

有沒有概念我的部分誤解:只是注意細節。

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 answerHow do you clear Apache Maven's cache?使用清除緩存的有效途徑,如果你根本就不想刪除存儲庫

更多<relativePath>,它的用途 -

父母的相對路徑<代碼> pom.xml < /代碼>文件 在結帳內。

默認值是../pom.xml

Maven先在當前構建項目的反應器中查找父pom,然後在文件系統上的此位置,然後是本地存儲庫,最後在遠程回購中查找父pom。

<代碼> relativePath < /代碼>允許選擇一個不同的位置,例如,當您的結構是平坦的,或更深,而沒有中間父POM。

但是,組ID,工件ID和版本仍然是必需的, 並且必須與給定位置中的文件匹配,否則它將恢復到POM的存儲庫。

此功能僅用於增強該項目在本地簽出的開發。

在你的情況下,從問題描述的結構不需要明確定義relativePath,並且可以使用其缺省值跳過其聲明。

+0

我已經嘗試了默認設置 - 結果相同。看了你的答案我在.m2下刪除了,並且還嘗試了mvn -U。沒有骰子。有一件事情讓我困擾;錯誤(a)的行號與當前版本的pom.xml中的行號不匹配,並且(b)不管我對pom.xml做什麼都不改變。我不知道如何/在哪裏mvn可能會選擇較舊/不同版本 – javadba

+0

@javadba行號不匹配是爲什麼我寫*「.. pom.xml被緩存」* 您的日誌(使用'-X')執行時'mvn clean install'應該讀取兩個你可能想要檢查的重要文件的位置(如果它們可能已被更新)... 1。 settings.xml可以從全局或用戶設置來確認您沒有任何updatePolicy更改2. maven-metadata.xml在.m2/中驗證它是否是最後更新的pom – nullpointer

+0

更新了OP,輸出了' mvn乾淨安裝-U -X'。由於風暴和互聯網中斷,我的響應延遲。 – javadba

1

我剛剛在poms中看到了版本差異。 1.0.0和1.0。檢查? 哦,你更新了相同的:)

+0

Thx for looking - 在十二小時內你錯過了五分鐘;)無論如何,我會給你一個upvote。 – javadba

相關問題