apache / apache/maven

[MNG-8129] Incorrect relative path in transitive dependencies leads to build failure

Open
#10,492 5 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Kedar Joshi](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kedarjoshi)** opened **[MNG-8129](https://issues.apache.org/jira/browse/MNG-8129?redirect=false)** and commented

I was trying to build Spring Boot v3.3.0 project with latest beta and got following error (which does not occur on v3.9.x) -

 

```java
[ERROR] Internal error: java.nio.file.InvalidPathException: Illegal char <:> at index 10: org.apache:apache -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.nio.file.InvalidPathException: Illegal char <:> at index 10: org.apache:apache
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:157)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:958)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:205)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke(Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 10: org.apache:apache
    at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
    at java.nio.file.Path.resolve(Path.java:516)
    at org.apache.maven.api.services.PathSource.resolve(PathSource.java:65)
    at org.apache.maven.internal.impl.model.DefaultModelBuilder.getParentPomFile(DefaultModelBuilder.java:1046)
    at org.apache.maven.internal.impl.model.DefaultModelBuilder.readParentLocally(DefaultModelBuilder.java:934)
    at org.apache.maven.internal.impl.model.DefaultModelBuilder.readParent(DefaultModelBuilder.java:904)
```

This exception occurs in **org.apache.maven.api.services.PathSource#resolve** method when parameter **relative** has value **org.apache:apache** since on Windows `:` is not allowed in file names.

In Maven v3.x, this scenario is handled with `exists` check on the parent file and thus issue does not occur. No such check is done in v4.0.

The source of the issue lies in **org.apache:apache** declaration in {**}https://repo.maven.apache.org/maven2/org/apache/activemq/artemis-project/2.33.0/artemis-project-2.33.0.pom{**}. As we can see, relative path **org.apache:apache** does not actually exist. 

 

I am using Windows 10 64 Bit.

 

 

---

**Affects:** 4.0.0-beta-3

0 votes, 6 watchers

Contributor guide

Open the contributing guide

Research direction

Start with org.apache.maven.api.services.PathSource#resolve and the callers in DefaultModelBuilder, then compare how Maven 3.x handles the parent path in the reported Artemis POM. Reproduce the failure on Windows with the org.apache:apache relativePath; done means the invalid relative path no longer causes the build failure while valid parent paths still resolve.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.