apache / apache/maven

[MNG-8056] Parameter '-f' & '-s' fails with absolute paths on Cygwin

Open
#10,810 0 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

**[Oliver Glowa](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ollily)** opened **[MNG-8056](https://issues.apache.org/jira/browse/MNG-8056?redirect=false)** and commented

Hello,

I'm using shell-script's running on github actions. For testing purpose I test the scripts locally on windows with cygwin. When working with absolute paths the parameter '-f', '-s' are failing on cygwin.

Similar problem like MNG-7621, but I don't see a chance to solve this as easy in the shell script, too. How do you will identify the path(s) from the commandline an replace it with a proper version.

## Tested with

* Windows 10x64 / 11x64
* Cygwin 3.5.0-1.x86_64
* Maven 3.9.6

1. Extract attachment "parametertest.zip to /cygdrive/c/temp
2. switch to /cygdrive/c/temp

## Log for "-f" with relative path

 

```java
postm@ollily08 /cygdrive/c/temp
$ mvn -f ./parametertest/pom.xml validate
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Programme-2\apache-maven\apache-maven
Java version: 19.0.2, vendor: Eclipse Adoptium, runtime: C:\Programme-3\AdoptOpenJDK\jdk-19.0.2+7
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.glowanet.test:parametertest >-------------------
[INFO] Building parametertest 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.181 s
[INFO] Finished at: 2024-02-18T11:12:29+01:00
[INFO] ------------------------------------------------------------------------
```

## Log for "-f" with absolute path

 

```java
postm@ollily08 /cygdrive/c/temp
$ mvn -f /cygdrive/c/temp/parametertest/pom.xml validate
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Programme-2\apache-maven\apache-maven
Java version: 19.0.2, vendor: Eclipse Adoptium, runtime: C:\Programme-3\AdoptOpenJDK\jdk-19.0.2+7
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM C:\cygdrive\c\temp\parametertest\pom.xml: C:\cygdrive\c\temp\parametertest\pom.xml (Das System kann den angegebenen Pfad nicht finden) @
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project  (C:\cygdrive\c\temp\parametertest\pom.xml) has 1 error
[ERROR]     Non-readable POM C:\cygdrive\c\temp\parametertest\pom.xml: C:\cygdrive\c\temp\parametertest\pom.xml (Das System kann den angegebenen Pfad nicht finden)
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

```

 

switch to /cygdrive/c/temp/parametertest

## Log for "-s" with relative path

```java
postm@ollily08 /cygdrive/c/temp/parametertest
$ mvn -s .m2/settings.xml validate
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Programme-2\apache-maven\apache-maven
Java version: 19.0.2, vendor: Eclipse Adoptium, runtime: C:\Programme-3\AdoptOpenJDK\jdk-19.0.2+7
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.glowanet.test:parametertest >-------------------
[INFO] Building parametertest 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.228 s
[INFO] Finished at: 2024-02-18T11:15:56+01:00
[INFO] ------------------------------------------------------------------------

```

## Log for "-s" with absolute path

```java
postm@ollily08 /cygdrive/c/temp/parametertest
$ mvn -s /cygdrive/c/temp/parametertest/.m2/settings.xml validate
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Programme-2\apache-maven\apache-maven
Java version: 19.0.2, vendor: Eclipse Adoptium, runtime: C:\Programme-3\AdoptOpenJDK\jdk-19.0.2+7
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[ERROR] Error executing Maven.
[ERROR] The specified user settings file does not exist: C:\cygdrive\c\temp\parametertest\.m2\settings.xml

```

 

---

**Affects:** 3.9.6

**Attachments:**
- [parametertest.zip](https://issues.apache.org/jira/secure/attachment/13066864/parametertest.zip) (_1.41 kB_)

**Issue Links:**
- [MNG-5812](https://issues.apache.org/jira/browse/MNG-5812) Project base dir not fully working in Cygwin

- [MNG-7621](https://issues.apache.org/jira/browse/MNG-7621) Parameter '-f' causes ignoring any 'maven.config' (only on Windows)

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported `mvn -f` and `mvn -s` commands under Cygwin using the attached parametertest.zip, comparing relative and absolute paths. Start by tracing Maven's command-line handling for `-f` and `-s`, then review MNG-5812 and MNG-7621 for related behavior. Done means absolute Cygwin paths resolve correctly for both options without breaking Windows paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, shell
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.