HomeOfTheWizard commented on issue #496:
URL: https://github.com/apache/maven-mvnd/issues/496#issuecomment-2276266613

   > > (1) make sure it never shuts down, because it's a daemon
   > 
   > There is currently no easy way to start the daemon process directly. But 
it is not that hard to put together the necessary command. You could e.g. start 
the daemon via `mvnd -v` and then find the command that the mvnd client used to 
start the daemon via `ps -e -f | grep mvnd`. On my machine, I see this:
   > 
   > ```
   > /home/ppalaga/.sdkman/candidates/java/21.2.0.r16-grl/bin/java -classpath 
/home/ppalaga/.sdkman/candidates/mvnd/0.6.0/mvn/lib/ext/mvnd-common-0.6.0.jar:/home/ppalaga/.sdkman/candidates/mvnd/0.6.0/mvn/lib/ext/mvnd-agent-0.6.0.jar
 
-javaagent:/home/ppalaga/.sdkman/candidates/mvnd/0.6.0/mvn/lib/ext/mvnd-agent-0.6.0.jar
 --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Xms128M -Xmx6G 
-Dmvnd.home=/home/ppalaga/.sdkman/c
 andidates/mvnd/0.6.0 
-Dmvnd.java.home=/home/ppalaga/.sdkman/candidates/java/21.2.0.r16-grl 
-Dlogback.configurationFile=/home/ppalaga/.sdkman/candidates/mvnd/0.6.0/conf/logback.xml
 -Dmvnd.id=ffe0de8d -Dmvnd.daemonStorage=/home/ppalaga/.m2/mvnd/registry/0.6.0 
-Dmvnd.registry=/home/ppalaga/.m2/mvnd/registry/0.6.0/registry.bin 
-Dmvnd.socketFamily=inet -Djdk.java.options= --add-opens 
java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED 
--add-opens java.base/java.util=ALL-UNNAMED --add-opens 
java.base/sun.nio.fs=ALL-UNNAMED -Dmvnd.noDaemon=false -Dmvnd.debug=false 
-Dmvnd.idleTimeout=3h -Dmvnd.keepAlive=100ms -Dmvnd.extClasspath= 
-Dmvnd.coreExtensions= -Dmvnd.minHeapSize=128M -Dmvnd.maxHeapSize=6G 
-Dmvnd.jvmArgs=--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 
--add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED --add-opens jd
 k.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens 
jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Dmvnd.enableAssertions=false 
-Dmvnd.expirationCheckDelay=10s -Dmvnd.duplicateDaemonGracePeriod=10s 
-Dmvnd.socketFamily=inet org.mvndaemon.mvnd.common.MavenDaemon
   > ```
   > 
   > You could then put a similar command to your dockerfile.
   > 
   > > (2) have a way to make my source code (of the project i need to build) 
visible into that long-running container when i want to call its mvn, maybe 
this is feasible with a softlink
   > 
   > You could perhaps mount your whole home folder or whichever folder 
containing all your projects? Then you could do something like `docker exec 
CONTAINER cd /mnt/rel/path/to/my/project && mvnd <goals>`
   
   I have tested this approach, but it seems the mvnd client does not 
necessarily use the already running deamon everytime, even if you trigger the 
same commands exactly :disappointed: 
   
   I have a project here where I run a container with a docker deamon as main 
process, and execute mvnd client by connecting to it via `docker exec 
<container> mvnd clean install`.
   
https://github.com/HomeOfTheWizard/vault-mvnd-benchmark/blob/main/docker/launch-mvnd.sh
   
   It never uses the main deamon already running on the container. 
   However, If I run  `docker exec <container> mvnd clean install` twice fast 
enough, the second command uses the same deamon as the first one (not the same 
that is running as main process in the container, but a new one created by the 
first "docker exec")
   
   Maybe I am missing something, or we need to implement a logic that is 
reproducible for clients that requires selecting specific deamons.
   @cstamas  I have found that issue #955.
   Is this something we can integrate into that topic ?
   If needed, I can happily help to code it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to