我的項目具有結構非解析父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.
如果使用intelliJ,你也可以試試這個[首選項>構建,執行,部署>構建工具> Maven>導入>取消選中'自動導入Maven項目']並再次構建項目。這將避免同時在IDEA和Maven中同步模塊/項目。如果intelliJ正在緩存不正確的密鑰,則可能會工作。 – nullpointer
我至少有五年的時間不受限制。 – javadba