{"id":13458630,"url":"https://github.com/apache/maven-mvnd","last_synced_at":"2025-04-10T18:09:23.580Z","repository":{"id":36965339,"uuid":"210029529","full_name":"apache/maven-mvnd","owner":"apache","description":"Apache Maven Daemon","archived":false,"fork":false,"pushed_at":"2025-04-09T10:21:12.000Z","size":3534,"stargazers_count":2994,"open_issues_count":138,"forks_count":214,"subscribers_count":61,"default_branch":"master","last_synced_at":"2025-04-10T11:59:04.004Z","etag":null,"topics":["apache-maven","build-management","java","maven"],"latest_commit_sha":null,"homepage":"https://maven.apache.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-21T17:49:30.000Z","updated_at":"2025-04-09T18:52:21.000Z","dependencies_parsed_at":"2023-01-17T09:03:58.330Z","dependency_job_id":"a490228f-1565-4381-95d9-92d672d30517","html_url":"https://github.com/apache/maven-mvnd","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fmaven-mvnd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fmaven-mvnd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fmaven-mvnd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fmaven-mvnd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/maven-mvnd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248267962,"owners_count":21075475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-maven","build-management","java","maven"],"created_at":"2024-07-31T09:00:54.686Z","updated_at":"2025-04-10T18:09:23.559Z","avatar_url":"https://github.com/apache.png","language":"Java","readme":"= `mvnd` - the Maven Daemon\n:toc: macro\n\nimage::https://img.shields.io/twitter/url/https/twitter.com/mvndaemon.svg?style=social\u0026label=Follow%20%40mvndaemon[link=\"https://twitter.com/mvndaemon\"]\n\ntoc::[]\n\n== Introduction\n\nThis project aims at providing faster https://maven.apache.org/[Maven] builds using techniques known from Gradle and\nTakari.\n\nArchitecture overview:\n\n* `mvnd` embeds Maven (so there is no need to install Maven separately).\n* The actual builds happen inside a long living background process, a.k.a. daemon.\n* One daemon instance can serve multiple consecutive requests from the `mvnd` client.\n* The `mvnd` client is a native executable built using https://www.graalvm.org/reference-manual/native-image/[GraalVM].\n  It starts faster and uses less memory compared to starting a traditional JVM.\n* Multiple daemons can be spawned in parallel if there is no idle daemon to serve a build request.\n\nThis architecture brings the following advantages:\n\n* The JVM for running the actual builds does not need to get started anew for each build.\n* The classloaders holding classes of Maven plugins are cached over multiple builds. The plugin jars are thus read\n  and parsed just once. SNAPSHOT versions of Maven plugins are not cached.\n* The native code produced by the Just-In-Time (JIT) compiler inside the JVM is kept too. Compared to stock Maven,\n  less time is spent by the JIT compilation. During the repeated builds the JIT-optimized code is available\n  immediately. This applies not only to the code coming from Maven plugins and Maven Core, but also to all code coming\n  from the JDK itself.\n\n== Additional features\n\n`mvnd` brings the following features on top of the stock Maven:\n\n* By default, `mvnd` is building your modules in parallel using multiple CPU cores. The number of utilized cores is\n  given by the formula `Math.max(Runtime.getRuntime().availableProcessors() - 1, 1)`. If your source tree does not\n  support parallel builds, pass `-T1` into the command line to make your build serial.\n* Improved console output: we believe that the output of a parallel build on stock Maven is hard to follow. Therefore,\nwe implemented a simplified non-rolling view showing the status of each build thread on a separate line. This is\nwhat it looks like on a machine with 24 cores:\n+\nimage::https://user-images.githubusercontent.com/1826249/103917178-94ee4500-510d-11eb-9abb-f52dae58a544.gif[]\n+\nOnce the build is finished, the complete Maven output is forwarded to the console.\n\n== How to install `mvnd`\n\n=== Install using https://sdkman.io/[SDKMAN!]\n\nIf SDKMAN! supports your operating system, it is as easy as\n\n[source,shell]\n----\nsdk install mvnd\n----\n\nIf you used the manual install in the past, please make sure that the settings in `~/.m2/mvnd.properties` still make\nsense. With SDKMAN!, the `~/.m2/mvnd.properties` file is typically not needed at all, because both `JAVA_HOME` and\n`MVND_HOME` are managed by SDKMAN!.\n\n=== Install using https://brew.sh/[Homebrew]\n\n[source,shell]\n----\nbrew install mvndaemon/homebrew-mvnd/mvnd\n----\n\nNote: There are two formulae: the `mvnd` that install latest, and `mvnd@1` that installs 1.x line.\n\n=== Install using https://www.macports.org[MacPorts]\n\n[source,shell]\n----\nsudo port install mvnd\n----\n\n=== Other installers\n\nWe're looking for contribution to support https://community.chocolatey.org/packages/mvndaemon/[Chocolatey], https://scoop.sh/[Scoop] or\nhttps://github.com/joschi/asdf-mvnd#install[asdf].  If you fancy helping us...\n\n////\n=== Install using https://www.macports.org[MacPorts]\n\n[source,shell]\n----\n$ sudo port install mvnd\n----\n\n=== Install using https://community.chocolatey.org/packages/mvndaemon/[Chocolatey]\n\n[source,shell]\n----\n$ choco install mvndaemon\n----\n\n=== Install using https://scoop.sh/[Scoop]\n\n[source,shell]\n----\n$ scoop install mvndaemon\n----\n\n=== Install using https://github.com/joschi/asdf-mvnd#install[asdf]\n\n[source,shell]\n----\n$ asdf plugin-add mvnd\n$ asdf install mvnd latest\n----\n////\n\n=== Set up completion\n\nOptionally, you can set up completion as follows:\n[source,shell]\n----\n# ensure that MVND_HOME points to your mvnd distribution, note that sdkman does it for you\n$ echo 'source $MVND_HOME/bin/mvnd-bash-completion.bash' \u003e\u003e ~/.bashrc\n----\n`bash` is the only shell supported at this time.\n\n=== Install manually\n\n* Download the latest ZIP suitable for your platform from https://downloads.apache.org/maven/mvnd/\n* Unzip to a directory of your choice\n* Add the `bin` directory to `PATH`\n* Optionally, you can create `~/.m2/mvnd.properties` and set the `java.home` property in case you do not want to bother\n  with setting the `JAVA_HOME` environment variable.\n* Test whether `mvnd` works:\n+\n[source,shell]\n----\n$ mvnd --version\nMaven Daemon 0.0.11-linux-amd64 (native)\nTerminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.osx.OsXNativePty\nApache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)\nMaven home: /home/ppalaga/orgs/mvnd/mvnd/daemon/target/maven-distro\nJava version: 11.0.1, vendor: AdoptOpenJDK, runtime: /home/data/jvm/adopt-openjdk/jdk-11.0.1+13\nDefault locale: en_IE, platform encoding: UTF-8\nOS name: \"linux\", version: \"5.6.13-200.fc31.x86_64\", arch: \"amd64\", family: \"unix\"\n----\n+\nIf you are on Windows and see a message that `VCRUNTIME140.dll was not found`, you need to install\n`vc_redist.x64.exe` from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads.\nSee https://github.com/oracle/graal/issues/1762 for more information.\n+\nIf you are on macOS, you'll need to remove the quarantine flags from all the files after unpacking the archive:\n[source,shell]\n----\n$ xattr -r -d com.apple.quarantine mvnd-x.y.z-darwin-amd64\n----\n\n== Usage\n\n`mvnd` is designed to accept the same command line options like stock `mvn` (plus some extras - see below), e.g.:\n\n[source,shell]\n----\nmvnd verify\n----\n\n== `mvnd` specific options\n\n`--status` lists running daemons\n\n`--stop` kills all running daemons\n\n`mvnd --help` prints the complete list of options\n\n\n== Configuration\nConfiguration can be provided through the properties file.  Mvnd reads the properties file from the following locations:\n\n* the properties path supplied using `MVND_PROPERTIES_PATH` environment variable or `mvnd.propertiesPath` system variable\n* the local properties path located at `[PROJECT_HOME]/.mvn/mvnd.properties`\n* the user properties path located at: `[USER_HOME]/.m2/mvnd.properties`\n* the system properties path located at: `[MVND_HOME]/conf/mvnd.properties`\n\nProperties defined in the first files will take precedence over properties specified in a lower ranked file.\n\nA few special properties do not follow the above mechanism:\n\n* `mvnd.daemonStorage`: this property defines the location where mvnd stores its files (registry and daemon logs).  This property can only be defined as a system property on the command line\n* `mvnd.id`: this property is used internally to identify the daemon being created\n* `mvnd.extClasspath`: internal option to specify the maven extension classpath\n* `mvnd.coreExtensionFilePath`: internal option to specify the maven extension configuration file path\n\nFor a full list of available properties please see \nhttps://github.com/apache/maven-mvnd/blob/master/dist/src/main/distro/conf/mvnd.properties[/dist/src/main/distro/conf/mvnd.properties].\n\n== Build `mvnd` from source\n\n=== Prerequisites:\n\n* `git`\n* Maven\n* Download and unpack GraalVM CE from https://github.com/graalvm/graalvm-ce-builds/releases[GitHub]\n* Set `JAVA_HOME` to where you unpacked GraalVM in the previous step. Check that `java -version` output is as\n  expected:\n+\n[source,shell]\n----\n$ $JAVA_HOME/bin/java -version\nopenjdk version \"11.0.9\" 2020-10-20\nOpenJDK Runtime Environment GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06)\nOpenJDK 64-Bit Server VM GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06, mixed mode, sharing)\n----\n+\n* Install the `native-image` tool:\n+\n[source,shell]\n----\n$ $JAVA_HOME/bin/gu install native-image\n----\n\n* `native-image` may require additional software to be installed depending on your platform - see the\nhttps://www.graalvm.org/reference-manual/native-image/#prerequisites[`native-image` documentation].\n\n=== Build `mvnd`\n\n[source,shell]\n----\n$ git clone https://github.com/apache/maven-mvnd.git\n$ cd maven-mvnd\n$ mvn clean verify -Pnative\n...\n$ cd client\n$ file target/mvnd\ntarget/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\n$ ls -lh target/mvnd\n-rwxrwxr-x. 1 ppalaga ppalaga 25M Jun  2 13:23 target/mvnd\n----\n\nPlease note that if you are using Windows as your operating system you will need the following prerequisites for building `maven-mvnd`:\na version of Visual Studio with the workload \"Desktop development with C++\" and the individual component \"Windows Universal CRT SDK\".\n\n=== Install `mvnd`\n\n[source, shell]\n----\n$ cp -R dist/target/mvnd-[version] [target-dir]\n----\n\nThen you can simply add `[target-dir]/bin` to your `PATH` and run `mvnd`. \n\nWe're happy to improve `mvnd`, so https://github.com/apache/maven-mvnd/issues[feedback] is most welcome!\n","funding_links":[],"categories":["Java","构建工具"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fmaven-mvnd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fmaven-mvnd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fmaven-mvnd/lists"}