[ https://issues.apache.org/jira/browse/MNG-6262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16107117#comment-16107117 ]
Dawid Weiss commented on MNG-6262: ---------------------------------- Related issue which compares file URIs and suffers from the same problem. Also: hard and symlinks on Windows (NTFS) definitely exist (I use them, for example), so inconsistent canonicalization or comparing by URIs is probably not a good idea. > getCanonicalFile() is not used consistently during project resolution > --------------------------------------------------------------------- > > Key: MNG-6262 > URL: https://issues.apache.org/jira/browse/MNG-6262 > Project: Maven > Issue Type: Bug > Components: core, Reactor and workspace > Affects Versions: 3.5.0, 3.5.1-candidate > Environment: Windows 7 > Reporter: Gene Smith > Priority: Minor > Attachments: test-inconsistent-canonicalization.zip > > > This bug manifests with... > * maven 3.5.0 *AND WITH* maven built from 3.5.1's unreleased sources > * on Windows 7 when the "Drive Letter" is configured with the wrong case. > * in projects which descend from a pom which does not reference them. > On Windows getCanonicalFile() is used on module File objects before they > are wrapped in a FileSource and cached. But DefaultModelBuilder compares > its cache hits against a File which has not been made cananonical. > Normally it does not matter on Windows, because the lack of symbolic links > makes it difficult to find an "Absolute File" which is not the same as its > "Canonical File", but there is at least one use case it happens in... > If invoking scripts use a "lower case drive letter" (ex: c:\, d:\, etc...) > then the "Canonical File" has an "upper case drive letter". > The error only seems to occur if a POM references a parent which does not list > the referencing POM as a child. In other words, when there is POM inheritance > without a reactor module relationship. In my use case there is a Dependency > Management POM which does not reference all the modules which list it as their > parent. > A simple work around is... > Make sure all your Windows Environments have capital drive letters in the > Jenkins node configuration, and scripting. > .......................... > {noformat} > Testing from sources: > https://git-wip-us.apache.org/repos/asf/maven.git > origin/master > b10025751 (HEAD -> master, origin/master, origin/MNG-5457_2, > origin/HEAD) [MNG-5457] Show repository id when downloading or uploading > from/to a remote repository > https://git-wip-us.apache.org/repos/asf/maven-resolver.git > origin/master > c9212232 (HEAD -> master, origin/master, origin/HEAD) > [maven-release-plugin] prepare for next development iteration > {noformat} > I found {{DefaultModelBuilder}} compares a POM's Non-Canonical File's URI > against a > cached Model's POM's Canonical File's URI. > {code} > org.apache.maven.model.building.DefaultModelBuilder > File pomFile = parentData.getModel().getPomFile(); > if ( pomFile != null ) > { > ModelSource expectedParentSource = getParentPomFile( childModel, > childSource ); > if ( expectedParentSource instanceof ModelSource2 > && !pomFile.toURI().equals( ( (ModelSource2) > expectedParentSource ).getLocationURI() ) ) > { > parentData = readParentExternally( childModel, request, > problems ); > } > } > {code} > Where {{ModelSource2}} is a {{org.apache.maven.building.FileSource}} which > has been > made from a canonical file. > In my test environment it composed and compared these two URIs for > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > and found they did not match: > file:/C:/Jenkins/workspace/test/pom.xml > file:/c:/Jenkins/workspace/test/pom.xml > resulting in this error output: > {noformat} > [ERROR] [ERROR] Some problems were encountered while processing the POMs: > [FATAL] Non-resolvable parent POM for > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT: Could not find > artifact > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > and 'parent.relativePath' points at wrong local POM @ > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT, > C:\Jenkins\workspace\test\reactor\pom.xml, line 5, column 11 > @ > [ERROR] The build could not read 1 project -> [Help 1] > org.apache.maven.project.ProjectBuildingException: Some problems were > encountered while processing the POMs: > [FATAL] Non-resolvable parent POM for > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT: Could not find > artifact > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > and 'parent.relativePath' points at wrong local POM @ > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT, > C:\Jenkins\workspace\test\reactor\pom.xml, line 5, column 11 > > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:382) > at > org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:400) > at > org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:391) > at > org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:78) > at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:511) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:221) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) > 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 > test-inconsistent-canonicalization:module:1.0.0-SNAPSHOT > (C:\Jenkins\workspace\test\reactor\module\pom.xml) has 1 error > [ERROR] Non-resolvable parent POM for > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT: Could not find > artifact > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > and 'parent.relativePath' points at wrong local POM @ > test-inconsistent-canonicalization:reactor:1.0.0-SNAPSHOT, > C:\Jenkins\workspace\test\reactor\pom.xml, line 5, column 11 -> [Help 2] > org.apache.maven.model.resolution.UnresolvableModelException: Could not > find artifact > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > at > org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:197) > at > org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:243) > at > org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1051) > at > org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:851) > at > org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:331) > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:429) > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:398) > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:515) > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:398) > at > org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:361) > at > org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:400) > at > org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:391) > at > org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:78) > at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:511) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:221) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) > 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 > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > at > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:453) > at > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:255) > at > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:232) > at > org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:303) > at > org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:193) > ... 27 more > Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could > not find artifact > test-inconsistent-canonicalization:dependency-management:pom:1.0.0-SNAPSHOT > at > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:443) > ... 31 more > [ERROR] > [ERROR] Re-run Maven using the -X switch to enable full debug logging. > [ERROR] > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)