apache / apache/maven-mvnd

"Unable to find the root directory" in multi-module build

Open
#901 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.5k
Forks
250
Avg merge
16h 22m
Merged PRs (30d)
36

Description

In different projects with multiple modules mvnd 1.0-m7 prints in the first line

Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.

But Maven 4.0.0-alpha-8 doesn't complain. In both cases Maven is started from the project root directory. Creating the ".mvn" directory doesn't mute the message printed by mvnd.

```
$ mvnd -1 -DskipTests clean compile
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
[INFO] Processing build on daemon 85f9f7c1
[INFO] Scanning for projects...
[INFO] BuildTimeEventSpy is registered.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
^C

$ mvn -DskipTests clean compile
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------------------------------------------
[INFO] Reactor Build Order:
^C

$ mvnd -v
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
Apache Maven Daemon (mvnd) 1.0-m7 linux-amd64 native client (b2ef5d81997adbcdb72dc8c5603722538fa641fe)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.linux.LinuxNativePty
Apache Maven 4.0.0-alpha-7 (bf699a388cc04b8e4088226ba09a403b68de6b7b)
Maven home: /home/wsl/bin/maven-mvnd-1.0-m7-m40-linux-amd64/mvn
Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-21-jdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.90.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

$ mvn -v
Apache Maven 4.0.0-alpha-8 (a2cbf4873a99c1aca7e3908086fe53b17865f07a)
Maven home: /home/wsl/bin/apache-maven-4.0.0-alpha-8
Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-21-jdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.90.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the warning with `mvnd -1 -DskipTests clean compile` and `mvnd -v` from a multi-module project root, comparing both with Maven 4.0.0-alpha-8. Start by tracing mvnd's root-directory detection around `.mvn` and the root="true" model attribute. Done means valid project roots no longer emit the warning while root detection still works.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.