apache / maven-mvnd

Apache Maven Daemon
https://maven.apache.org/
Apache License 2.0
2.94k stars 212 forks source link

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

Open calle2010 opened 1 year ago

calle2010 commented 1 year ago

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"
calle2010 commented 12 months ago

same behavior in mvnd 1.0-m8

ppalaga commented 12 months ago

Thanks for the report, @calle2010!

Creating the .mvn directory should solve the issue. I wonder whether there some kind of git push/pull in between that ignores empty directories?

slawekjaranowski commented 12 months ago

It was changed in alpha-8 - https://issues.apache.org/jira/browse/MNG-7898 - massage is printed in Debug level. but there is proposition to change level: https://issues.apache.org/jira/browse/MNG-7919