SapiensAnatis opened a new issue, #1257: URL: https://github.com/apache/maven-mvnd/issues/1257
Hi, I'm looking at developing a Visual Studio Code extension for [spotless](https://github.com/badsyntax/vscode-spotless-gradle) for Maven projects. Spotless has an [IDE hook](https://github.com/badsyntax/vscode-spotless-gradle) feature where editors can pass in a filename and then pipe the contents of a document to the Maven stdin, and get a formatting result on stdout. This allows formatting to be on e.g. on save without reading and writing a file twice and is meant to aid performance. If invoking manually, what this looks like in practice is: ``` $ cat src/main/java/com/mycompany/app/App.java | mvn spotless:apply -DspotlessIdeHook=/home/jay/Projects/vscode-spotless-maven/test-project/src/main/java/com/mycompany/app/App.java -DspotlessIdeHookUseStdIn -DspotlessIdeHookUseStdOut --quiet IS DIRTY /* (C)2025 */ package com.mycompany.app; /** * Hello world! */ public class App { public static void main(String[] args) { System.out.println("Hello World!"); } } ``` For my extension, I was hoping to use `mvnd`, as executing a new `mvn` process every time is proving to be quite slow - about 1.5 seconds every time you save a document. I expect that if I'm repeatedly invoking the same goal that I could see quite some performance gains from a persistent server - so it's great that this project exists. However, if I run the same command as above, but using `mvnd`, it just hangs. I wonder if the build daemon is waiting for stdin and the client doesn't support sending that yet? I've included the full debug logs below if that's of any use. <details> <summary>-X debug logs</summary> ``` Feb 02, 2025 2:40:17 PM org.jline.utils.Log logr WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) [main] WARNING org.jline - Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) Apache Maven Daemon (mvnd) 1.0.2 linux-amd64 native client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb) Terminal: org.jline.terminal.impl.DumbTerminal Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: /home/jay/.sdkman/candidates/mvnd/1.0.2/mvn Java version: 23.0.1, vendor: N/A, runtime: /usr/lib64/jvm/java-23-openjdk-23 Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "6.13.0-1-default", arch: "amd64", family: "unix" [DEBUG] Reading global settings from /home/jay/.sdkman/candidates/mvnd/1.0.2/mvn/conf/settings.xml [DEBUG] Reading user settings from /home/jay/.m2/settings.xml [DEBUG] Reading global toolchains from /home/jay/.sdkman/candidates/mvnd/1.0.2/mvn/conf/toolchains.xml [DEBUG] Reading user toolchains from /home/jay/.m2/toolchains.xml [INFO] Error stacktraces are turned on. [DEBUG] Message scheme: plain [INFO] Processing build on daemon 6d79d6ad [DEBUG] Using local repository at /home/jay/.m2/repository [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /home/jay/.m2/repository [INFO] Scanning for projects... [DEBUG] Extension realms for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: (none) [DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null] [DEBUG] Creating adapter using nameMapper 'file-gav' and factory 'file-lock' [INFO] BuildTimeEventSpy is registered. [DEBUG] Resolving plugin prefix spotless from [org.apache.maven.plugins, org.codehaus.mojo] [DEBUG] Resolved plugin prefix spotless to com.diffplug.spotless:spotless-maven-plugin from POM com.mycompany.app:my-app:jar:1.0-SNAPSHOT [DEBUG] === REACTOR BUILD PLAN ================================================ [DEBUG] Project: com.mycompany.app:my-app:jar:1.0-SNAPSHOT [DEBUG] Tasks: [spotless:apply] [DEBUG] Style: Regular [DEBUG] ======================================================================= [INFO] [INFO] Using the SmartBuilder implementation with a thread count of 15 [DEBUG] Task segments : [[spotless:apply]] [DEBUG] Build maximum degree of concurrency is 15 [DEBUG] Total number of projects is 1 [DEBUG] Ready com.mycompany.app:my-app [DEBUG] STARTED build of project com.mycompany.app:my-app [INFO] [INFO] ----------------------< com.mycompany.app:my-app >---------------------- [INFO] Building my-app 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [DEBUG] Resolving plugin prefix spotless from [org.apache.maven.plugins, org.codehaus.mojo] [DEBUG] Resolved plugin prefix spotless to com.diffplug.spotless:spotless-maven-plugin from POM com.mycompany.app:my-app:jar:1.0-SNAPSHOT [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean] [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy] [DEBUG] === PROJECT BUILD PLAN ================================================ [DEBUG] Project: com.mycompany.app:my-app:1.0-SNAPSHOT [DEBUG] Dependencies (collect): [] [DEBUG] Dependencies (resolve): [] [DEBUG] Repositories (dependencies): [central (https://repo.maven.apache.org/maven2, default, releases)] [DEBUG] Repositories (plugins) : [central (https://repo.maven.apache.org/maven2, default, releases)] [DEBUG] ----------------------------------------------------------------------- [DEBUG] Goal: com.diffplug.spotless:spotless-maven-plugin:2.44.2:apply (default-cli) [DEBUG] Style: Regular [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> <configuration> <applySkip default-value="false">${spotless.apply.skip}</applySkip> <baseDir default-value="${project.basedir}"/> <buildDir default-value="${project.build.directory}"/> <checkSkip default-value="false">${spotless.check.skip}</checkSkip> <encoding default-value="UTF-8"/> <filePatterns>${spotlessFiles}</filePatterns> <goal default-value="${mojoExecution.goal}"/> <java> <googleJavaFormat> <style>AOSP</style> <reflowLongStrings>true</reflowLongStrings> <formatJavadoc>false</formatJavadoc> </googleJavaFormat> <licenseHeader> <content>/* (C)$YEAR */</content> </licenseHeader> </java> <lineEndings default-value="GIT_ATTRIBUTES_FAST_ALLSAME"/> <m2eEnableForIncrementalBuild default-value="false"/> <project default-value="${project}"/> <repositories default-value="${project.remotePluginRepositories}"/> <repositorySystemSession default-value="${repositorySystemSession}"/> <setLicenseHeaderYearsFromGitHistory>${spotlessSetLicenseHeaderYearsFromGitHistory}</setLicenseHeaderYearsFromGitHistory> <skip default-value="false">${spotless.skip}</skip> <spotlessIdeHook>${spotlessIdeHook}</spotlessIdeHook> <spotlessIdeHookUseStdIn>${spotlessIdeHookUseStdIn}</spotlessIdeHookUseStdIn> <spotlessIdeHookUseStdOut>${spotlessIdeHookUseStdOut}</spotlessIdeHookUseStdOut> </configuration> [DEBUG] ======================================================================= [INFO] [INFO] --- spotless:2.44.2:apply (default-cli) @ my-app --- [DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=402463, ConflictMarker.markTime=108215, ConflictMarker.nodeCount=47, ConflictIdSorter.graphTime=198717, ConflictIdSorter.topsortTime=178078, ConflictIdSorter.conflictIdCount=28, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2782166, ConflictResolver.conflictItemCount=42, DfDependencyCollector.collectTime=65053927, DfDependencyCollector.transformTime=4617447} [DEBUG] com.diffplug.spotless:spotless-maven-plugin:jar:2.44.2 [DEBUG] com.diffplug.spotless:spotless-lib:jar:3.0.2:runtime [DEBUG] com.diffplug.spotless:spotless-lib-extra:jar:3.0.2:runtime [DEBUG] com.googlecode.concurrent-trees:concurrent-trees:jar:2.6.1:runtime [DEBUG] dev.equo.ide:solstice:jar:1.8.1:runtime [DEBUG] com.diffplug.durian:durian-swt.os:jar:4.3.0:runtime [DEBUG] org.tukaani:xz:jar:1.9:runtime [DEBUG] com.squareup.okhttp3:okhttp:jar:4.12.0:runtime [DEBUG] com.squareup.okio:okio:jar:3.6.0:runtime [DEBUG] com.squareup.okio:okio-jvm:jar:3.6.0:runtime [DEBUG] org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.9.10:runtime [DEBUG] org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.8.21:runtime [DEBUG] org.jetbrains.kotlin:kotlin-stdlib:jar:1.8.21:runtime [DEBUG] org.jetbrains:annotations:jar:13.0:runtime [DEBUG] org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.8.21:runtime [DEBUG] org.eclipse.platform:org.eclipse.osgi:jar:3.18.500:runtime [DEBUG] com.diffplug.durian:durian-core:jar:1.2.0:runtime [DEBUG] com.diffplug.durian:durian-io:jar:1.2.0:runtime [DEBUG] com.diffplug.durian:durian-collect:jar:1.2.0:runtime [DEBUG] org.codehaus.plexus:plexus-resources:jar:1.3.0:runtime [DEBUG] org.codehaus.plexus:plexus-utils:jar:4.0.0:runtime [DEBUG] org.codehaus.plexus:plexus-xml:jar:3.0.0:runtime [DEBUG] javax.inject:javax.inject:jar:1:runtime [DEBUG] org.slf4j:slf4j-api:jar:1.7.36:runtime [DEBUG] org.eclipse.jgit:org.eclipse.jgit:jar:6.10.0.202406032230-r:runtime [DEBUG] com.googlecode.javaewah:JavaEWAH:jar:1.2.3:runtime [DEBUG] commons-codec:commons-codec:jar:1.17.0:runtime [DEBUG] org.sonatype.plexus:plexus-build-api:jar:0.0.7:runtime [DEBUG] Created new class realm plugin>com.diffplug.spotless:spotless-maven-plugin:2.44.2 [DEBUG] Importing foreign packages into class realm plugin>com.diffplug.spotless:spotless-maven-plugin:2.44.2 [DEBUG] Imported: < maven.api [DEBUG] Populating class realm plugin>com.diffplug.spotless:spotless-maven-plugin:2.44.2 [DEBUG] Included: com.diffplug.spotless:spotless-maven-plugin:jar:2.44.2 [DEBUG] Included: com.diffplug.spotless:spotless-lib:jar:3.0.2 [DEBUG] Included: com.diffplug.spotless:spotless-lib-extra:jar:3.0.2 [DEBUG] Included: com.googlecode.concurrent-trees:concurrent-trees:jar:2.6.1 [DEBUG] Included: dev.equo.ide:solstice:jar:1.8.1 [DEBUG] Included: com.diffplug.durian:durian-swt.os:jar:4.3.0 [DEBUG] Included: org.tukaani:xz:jar:1.9 [DEBUG] Included: com.squareup.okhttp3:okhttp:jar:4.12.0 [DEBUG] Included: com.squareup.okio:okio:jar:3.6.0 [DEBUG] Included: com.squareup.okio:okio-jvm:jar:3.6.0 [DEBUG] Included: org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.9.10 [DEBUG] Included: org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.8.21 [DEBUG] Included: org.jetbrains.kotlin:kotlin-stdlib:jar:1.8.21 [DEBUG] Included: org.jetbrains:annotations:jar:13.0 [DEBUG] Included: org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.8.21 [DEBUG] Included: org.eclipse.platform:org.eclipse.osgi:jar:3.18.500 [DEBUG] Included: com.diffplug.durian:durian-core:jar:1.2.0 [DEBUG] Included: com.diffplug.durian:durian-io:jar:1.2.0 [DEBUG] Included: com.diffplug.durian:durian-collect:jar:1.2.0 [DEBUG] Included: org.codehaus.plexus:plexus-resources:jar:1.3.0 [DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:4.0.0 [DEBUG] Included: org.codehaus.plexus:plexus-xml:jar:3.0.0 [DEBUG] Included: org.eclipse.jgit:org.eclipse.jgit:jar:6.10.0.202406032230-r [DEBUG] Included: com.googlecode.javaewah:JavaEWAH:jar:1.2.3 [DEBUG] Included: commons-codec:commons-codec:jar:1.17.0 [DEBUG] Included: org.sonatype.plexus:plexus-build-api:jar:0.0.7 [DEBUG] Loading mojo com.diffplug.spotless:spotless-maven-plugin:2.44.2:apply from plugin realm ClassRealm[plugin>com.diffplug.spotless:spotless-maven-plugin:2.44.2, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@5a07e868] [DEBUG] Configuring mojo execution 'com.diffplug.spotless:spotless-maven-plugin:2.44.2:apply:default-cli' with basic configurator --> [DEBUG] (f) applySkip = false [DEBUG] (f) baseDir = /home/jay/Projects/vscode-spotless-maven/test-project [DEBUG] (f) buildDir = /home/jay/Projects/vscode-spotless-maven/test-project/target [DEBUG] (f) checkSkip = false [DEBUG] (f) encoding = UTF-8 [DEBUG] (f) goal = apply [DEBUG] (f) style = AOSP [DEBUG] (f) reflowLongStrings = true [DEBUG] (f) formatJavadoc = false [DEBUG] (s) googleJavaFormat = com.diffplug.spotless.maven.java.GoogleJavaFormat@2d4ca076 [DEBUG] (f) content = /* (C)$YEAR */ [DEBUG] (s) licenseHeader = com.diffplug.spotless.maven.generic.LicenseHeader@421d71a [DEBUG] (f) java = com.diffplug.spotless.maven.java.Java@5b096d59 [DEBUG] (f) lineEndings = GIT_ATTRIBUTES_FAST_ALLSAME [DEBUG] (f) m2eEnableForIncrementalBuild = false [DEBUG] (f) project = MavenProject: com.mycompany.app:my-app:1.0-SNAPSHOT @ /home/jay/Projects/vscode-spotless-maven/test-project/pom.xml [DEBUG] (f) repositories = [central (https://repo.maven.apache.org/maven2, default, releases)] [DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@6a62ed4f [DEBUG] (f) skip = false [DEBUG] (f) spotlessIdeHook = /home/jay/Projects/vscode-spotless-maven/test-project/src/main/java/com/mycompany/app/App.java [DEBUG] (f) spotlessIdeHookUseStdIn = true [DEBUG] (f) spotlessIdeHookUseStdOut = true [DEBUG] -- end configuration -- [DEBUG] register org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda/0x00007f9813329388@1dbeb89e with shutdown hook [DEBUG] file=null, size changed from -1 to 231 bytes [DEBUG] file=/home/jay/.gitconfig, create new FileSnapshot: lastRead=2025-02-02 14:40:18.745237040, lastModified=2024-12-31 01:55:59.030587207, size=231, fileKey=(dev=32,ino=4129045) [DEBUG] file=null, size changed from -1 to 0 bytes [DEBUG] file=/home/jay/Projects/vscode-spotless-maven/.git/config, create new FileSnapshot: lastRead=2025-02-02 14:40:18.752618288, lastModified=2025-02-01 20:55:02.983368496, size=334, fileKey=(dev=32,ino=6203005) [DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=22953, ConflictMarker.markTime=50306, ConflictMarker.nodeCount=9, ConflictIdSorter.graphTime=8836, ConflictIdSorter.topsortTime=8527, ConflictIdSorter.conflictIdCount=8, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=281223, ConflictResolver.conflictItemCount=8, DfDependencyCollector.collectTime=14530768, DfDependencyCollector.transformTime=384149} [DEBUG] Resolved artifact: com.google.googlejavaformat:google-java-format:jar:1.24.0 < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.guava:guava:jar:32.1.3-jre < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.guava:failureaccess:jar:1.0.1 < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.code.findbugs:jsr305:jar:3.0.2 < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: org.checkerframework:checker-qual:jar:3.37.0 < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.errorprone:error_prone_annotations:jar:2.21.1 < central (https://repo.maven.apache.org/maven2, default, releases) [DEBUG] Resolved artifact: com.google.j2objc:j2objc-annotations:jar:2.8 < central (https://repo.maven.apache.org/maven2, default, releases) ``` </details> I would appreciate any guidance you are able to offer. Let me know if you want further details - would be happy to assist. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
