mvnd: Maven Daemon
The mvnd project aims to provide a daemon infrastructure for maven based builds. It borrows techniques from Gradle and Takari to provide a simple and efficient system.
Install mvnd
If you are on Linux or Mac, you can use the following shell commands. On Windows, you can perform the steps manually.
cd ~/bin # (1)
os=$(uname | tr '[:upper:]' '[:lower:]') # (2)
curl -L https://github.com/mvndaemon/mvnd/releases/latest/download/mvnd-${os}-amd64 -o mvnd # (3)
chmod +x mvnd # (4)
mvnd --install # (5)-
Change to
~/binor any other location already included inPATH; otherwise, you’ll need to addmvndtoPATHmanually -
Detect the name of the current operating system and turn it to lower case
-
Download the latest
mvndexecutable for the given OS frommvndreleases page; store the executable asmvnd(ormvnd.exeon Windows) -
Make it executable (not required on Windows)
-
Run
mvnd --installto download and install the server part. This will:-
Download
mvnd-dist.zip -
Unpack it to
~/.m2/mvnd/<version> -
Create
~/.m2/mvnd.propertiesIf your are on Windows and see a message that
VCRUNTIME140.dll was not found, you need to installvc_redist.x64.exefrom https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads. See oracle/graal#1762 for more information.
-
Optionally, you can open ~/.m2/mvnd.properties and set the java.home property in case you do not want to bother with setting JAVA_HOME environment variable.
+
Now you can test whether mvnd works:
$ mvnd --version
Maven Daemon 0.0.0 (native)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/ppalaga/orgs/mvnd/mvnd/daemon/target/maven-distro
Java version: 11.0.1, vendor: AdoptOpenJDK, runtime: /home/data/jvm/adopt-openjdk/jdk-11.0.1+13
Default locale: en_IE, platform encoding: UTF-8
OS name: "linux", version: "5.6.13-200.fc31.x86_64", arch: "amd64", family: "unix"Usage
mvnd is designed to accept the same command line options like stock mvn (plus some extras - see below), e.g.:
mvnd clean installmvnd specific options
--install installs the server part
--status lists running daemons
--stop kills all running daemons
Build mvnd from source
Prerequisites:
-
git -
Maven
-
Download and unpack GraalVM CE from GitHub
-
Set
JAVA_HOMEto where you unpacked GraalVM in the previous step. Check thatjava -versionoutput is as expected:$ $JAVA_HOME/bin/java -version openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
-
Install the
native-imagetool:$ $JAVA_HOME/bin/gu install native-image -
native-imagemay require additional software to be installed depending on your platform - see thenative-imagedocumentation.
Build mvnd
$ git clone https://github.com/mvndaemon/mvnd.git
$ cd mvnd
$ mvn clean verify -Pnative
...
$ cd client
$ file target/mvnd
target/mvnd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=93a554f3807550a13c986d2af9a311ef299bdc5a, for GNU/Linux 3.2.0, with debug_info, not stripped
$ ls -lh target/mvnd
-rwxrwxr-x. 1 ppalaga ppalaga 25M Jun 2 13:23 target/mvndThis project is still in prototype mode, so feedback is most welcomed!