(maven-mvnd) branch master updated: Make TerminalOutput.pathToMaven() more robust to avoid #929

2024-04-25 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 73bfecb1 Make TerminalOutput.pathToMaven() more robust to avoid #929
73bfecb1 is described below

commit 73bfecb19edd9951c7f975825333a3d04f814a0e
Author: Peter Palaga 
AuthorDate: Fri Apr 12 16:04:16 2024 +0200

Make TerminalOutput.pathToMaven() more robust to avoid #929
---
 .../mvnd/common/logging/TerminalOutput.java| 66 --
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git 
a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java
index 72fa82e4..d9877f0c 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java
@@ -714,37 +714,45 @@ public class TerminalOutput implements ClientOutput {
 
 public static String pathToMaven(String location) {
 String[] p = location.split("/");
-if (p.length >= 4 && p[p.length - 1].startsWith(p[p.length - 3] + "-" 
+ p[p.length - 2])) {
-String artifactId = p[p.length - 3];
-String version = p[p.length - 2];
-String classifier;
-String type;
-String artifactIdVersion = artifactId + "-" + version;
-StringBuilder sb = new StringBuilder();
-if (p[p.length - 1].charAt(artifactIdVersion.length()) == '-') {
-classifier =
-p[p.length - 1].substring(artifactIdVersion.length() + 
1, p[p.length - 1].lastIndexOf('.'));
-} else {
-classifier = null;
-}
-type = p[p.length - 1].substring(p[p.length - 1].lastIndexOf('.') 
+ 1);
-for (int j = 0; j < p.length - 3; j++) {
-if (j > 0) {
-sb.append('.');
-}
-sb.append(p[j]);
-}
-sb.append(':').append(artifactId).append(':').append(version);
-if (!"jar".equals(type) || classifier != null) {
-sb.append(':');
-if (!"jar".equals(type)) {
-sb.append(type);
-}
-if (classifier != null) {
-sb.append(':').append(classifier);
+if (p.length >= 4) {
+final String artifactId = p[p.length - 3];
+final String version = p[p.length - 2];
+final String fileName = p[p.length - 1];
+final int artifactIdVersionLength = artifactId.length() + 1 /* the 
dash */ + version.length();
+if (fileName.length() > artifactIdVersionLength) {
+/* We use fileName.length() > to avoid 
https://github.com/apache/maven-mvnd/issues/929
+ * In the code below, we assume that the fileName ends either 
with `.`
+ * or `-.` */
+final int lastPeriodPos = fileName.lastIndexOf('.');
+if (lastPeriodPos >= 0) {
+final String classifier;
+final String type;
+final StringBuilder sb = new StringBuilder();
+if (fileName.charAt(artifactIdVersionLength) == '-') {
+classifier = 
fileName.substring(artifactIdVersionLength + 1, lastPeriodPos);
+} else {
+classifier = null;
+}
+type = fileName.substring(lastPeriodPos + 1);
+for (int j = 0; j < p.length - 3; j++) {
+if (j > 0) {
+sb.append('.');
+}
+sb.append(p[j]);
+}
+
sb.append(':').append(artifactId).append(':').append(version);
+if (!"jar".equals(type) || classifier != null) {
+sb.append(':');
+if (!"jar".equals(type)) {
+sb.append(type);
+}
+if (classifier != null) {
+sb.append(':').append(classifier);
+}
+}
+return sb.toString();
 }
 }
-return sb.toString();
 }
 return location;
 }



(maven-mvnd) branch master updated: Update README.adoc

2024-03-18 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 90b505a9 Update README.adoc
90b505a9 is described below

commit 90b505a9e760b15659d871e83c4d37e2a3c69cd5
Author: Nathan Sit 
AuthorDate: Fri Mar 15 10:45:34 2024 -0700

Update README.adoc
---
 README.adoc | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/README.adoc b/README.adoc
index bea3c8aa..f0935afb 100644
--- a/README.adoc
+++ b/README.adoc
@@ -35,8 +35,8 @@ This architecture brings the following advantages:
 
 * By default, `mvnd` is building your modules in parallel using multiple CPU 
cores. The number of utilized cores is
   given by the formula `Math.max(Runtime.getRuntime().availableProcessors() - 
1, 1)`. If your source tree does not
-  support parallel builds, pass `-T1` on the command line to make your build 
serial.
-* Improved console output: we believe that the output of a parallel build on a 
stock Maven is hard to follow. Therefore,
+  support parallel builds, pass `-T1` into the command line to make your build 
serial.
+* Improved console output: we believe that the output of a parallel build on 
stock Maven is hard to follow. Therefore,
 we implemented a simplified non-rolling view showing the status of each build 
thread on a separate line. This is
 what it looks like on a machine with 24 cores:
 +
@@ -70,7 +70,7 @@ $ brew install mvndaemon/homebrew-mvnd/mvnd
 
 We're looking for contribution to support https://www.macports.org[MacPorts],
 https://community.chocolatey.org/packages/mvndaemon/[Chocolatey], 
https://scoop.sh/[Scoop] or
-https://github.com/joschi/asdf-mvnd#install[asdf].  If you're fancy helping 
us...
+https://github.com/joschi/asdf-mvnd#install[asdf].  If you fancy helping us...
 
 
 === Install using https://www.macports.org[MacPorts]
@@ -108,7 +108,7 @@ $ asdf install mvnd latest
 Optionally, you can set up completion as follows:
 [source,shell]
 
-# ensure to set MVND_HOME to point to your mvnd distribution, note that sdkman 
does it for you
+# ensure that MVND_HOME points to your mvnd distribution, note that sdkman 
does it for you
 $ echo 'source $MVND_HOME/bin/mvnd-bash-completion.bash' >> ~/.bashrc
 
 `bash` is the only shell supported at this time.
@@ -128,7 +128,7 @@ $ unalias mvnd
 * Unzip to a directory of your choice
 * Add the `bin` directory to `PATH`
 * Optionally, you can create `~/.m2/mvnd.properties` and set the `java.home` 
property in case you do not want to bother
-  with setting `JAVA_HOME` environment variable.
+  with setting the `JAVA_HOME` environment variable.
 * Test whether `mvnd` works:
 +
 [source,shell]
@@ -168,11 +168,11 @@ mvnd verify
 
 `--stop` kills all running daemons
 
-The complete list of options is printed when executing `mvnd --help`.
+`mvnd --help` prints the complete list of options
 
 
 == Configuration
-Configuration can be provided through properties file.  Mvnd read properties 
file from the following locations:
+Configuration can be provided through the properties file.  Mvnd reads the 
properties file from the following locations:
 
 * the properties path supplied using `MVND_PROPERTIES_PATH` environment 
variable or `mvnd.propertiesPath` system variable
 * the local properties path located at `[PROJECT_HOME]/.mvn/mvnd.properties`



(maven-mvnd) branch master updated: Update to mvn 3.9.6

2024-03-15 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 1d246800 Update to mvn 3.9.6
1d246800 is described below

commit 1d246800d4951e7557bb212eaef7cacab5397e24
Author: Nathan Sit 
AuthorDate: Thu Mar 14 12:53:46 2024 -0700

Update to mvn 3.9.6

Changes:
* Update mvn from 3.9.5 to 3.9.6
* Update resolver from 1.9.16 to 1.9.18
* Update surefire from 3.1.2 to 3.2.2
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 778eeb57..a59479c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,10 +89,10 @@
 3.24.0
 5.9.2
 4.0.0-alpha-8
-3.9.5
+3.9.6
 ${maven.version}
 
-1.9.16
+1.9.18
 1.7.36
 0.9.0.M2
 
@@ -104,7 +104,7 @@
 3.1.1
 3.5.0
 1.5.0
-3.1.2
+3.2.2
 1.3.2
 3.0.1
 1.0.20



[maven-mvnd] branch master updated: [MNG-6847] Use diamond operator

2023-09-26 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 685ca13b [MNG-6847] Use diamond operator
685ca13b is described below

commit 685ca13bff73654f1f2b272c9976259c565cf8a6
Author: Tim te Beek 
AuthorDate: Mon Sep 25 21:35:04 2023 +

[MNG-6847] Use diamond operator

Use this link to re-run the recipe: 
https://app.moderne.io/recipes/builder/SEvWu02zw?organizationId=QXBhY2hlIE1hdmVu

Co-authored-by: Moderne 
---
 build-plugin/src/main/java/org/mvndaemon/mvnd/plugin/doc/DocMojo.java | 2 +-
 native/src/main/java/org/mvndaemon/mvnd/nativ/MvndNativeLoader.java   | 2 +-
 native/src/main/java/org/mvndaemon/mvnd/nativ/OSInfo.java | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/build-plugin/src/main/java/org/mvndaemon/mvnd/plugin/doc/DocMojo.java 
b/build-plugin/src/main/java/org/mvndaemon/mvnd/plugin/doc/DocMojo.java
index 891e9d82..0b089817 100644
--- a/build-plugin/src/main/java/org/mvndaemon/mvnd/plugin/doc/DocMojo.java
+++ b/build-plugin/src/main/java/org/mvndaemon/mvnd/plugin/doc/DocMojo.java
@@ -125,7 +125,7 @@ public class DocMojo extends AbstractMojo {
 @Override
 public synchronized Enumeration keys() {
 final Iterator it = new TreeSet<>(keySet()).iterator();
-return new Enumeration() {
+return new Enumeration<>() {
 public boolean hasMoreElements() {
 return it.hasNext();
 }
diff --git 
a/native/src/main/java/org/mvndaemon/mvnd/nativ/MvndNativeLoader.java 
b/native/src/main/java/org/mvndaemon/mvnd/nativ/MvndNativeLoader.java
index 0be5020d..cdfae9d0 100644
--- a/native/src/main/java/org/mvndaemon/mvnd/nativ/MvndNativeLoader.java
+++ b/native/src/main/java/org/mvndaemon/mvnd/nativ/MvndNativeLoader.java
@@ -262,7 +262,7 @@ public class MvndNativeLoader {
 return;
 }
 
-List triedPaths = new LinkedList();
+List triedPaths = new LinkedList<>();
 
 // Try loading library from library.mvndnative.path library path */
 String mvndnativeNativeLibraryPath = 
System.getProperty("library.mvndnative.path");
diff --git a/native/src/main/java/org/mvndaemon/mvnd/nativ/OSInfo.java 
b/native/src/main/java/org/mvndaemon/mvnd/nativ/OSInfo.java
index 05cad9d2..16f91919 100644
--- a/native/src/main/java/org/mvndaemon/mvnd/nativ/OSInfo.java
+++ b/native/src/main/java/org/mvndaemon/mvnd/nativ/OSInfo.java
@@ -39,7 +39,7 @@ public class OSInfo {
 public static final String PPC64 = "ppc64";
 public static final String ARM64 = "arm64";
 
-private static final HashMap archMapping = new 
HashMap();
+private static final HashMap archMapping = new HashMap<>();
 
 static {
 // x86 mappings



[maven-build-cache-extension] branch master updated: [MBUILDCACHE-51] Broken link to maven-build-cache-config.xml template on Getting Started page

2023-06-04 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git


The following commit(s) were added to refs/heads/master by this push:
 new 29b39b0  [MBUILDCACHE-51] Broken link to maven-build-cache-config.xml 
template on Getting Started page
29b39b0 is described below

commit 29b39b0834b038d4957a99c64882aa880b666bbc
Author: Peter Palaga 
AuthorDate: Sun Jun 4 12:21:41 2023 +0200

[MBUILDCACHE-51] Broken link to maven-build-cache-config.xml template on
Getting Started page
---
 src/site/markdown/getting-started.md.vm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/site/markdown/getting-started.md.vm 
b/src/site/markdown/getting-started.md.vm
index 07ba2a5..c056afb 100644
--- a/src/site/markdown/getting-started.md.vm
+++ b/src/site/markdown/getting-started.md.vm
@@ -42,8 +42,8 @@ more sophisticated optimizations in the future.
 
 #[[###]]# Adding build cache config
 
-Copy template config 
[`maven-build-cache-config.xml`](../resources/maven-build-cache-config.xml)
-to [`.mvn/`](https://maven.apache.org/configure.html) directory of your 
project.  
+Copy template config 
[`maven-build-cache-config.xml`](maven-build-cache-config.xml)
+to [`.mvn/`](https://maven.apache.org/configure.html) directory of your 
project.
 To understand the caching machinery, review the config and read the comments. 
In a typical scenario, you need to:
 
 * Exclude unstable, temporary files or environment-specific files



[maven-mvnd] 02/02: JAVA_HOME should be documented as discriminating #852

2023-05-23 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 7d9a39be1a49e56cdc3792ffcd503b9c42af86bd
Author: Peter Palaga 
AuthorDate: Mon May 22 14:30:30 2023 +0200

JAVA_HOME should be documented as discriminating #852
---
 .../java/org/mvndaemon/mvnd/common/Environment.java | 21 ++---
 .../org/apache/maven/cli/MvndHelpFormatter.java |  2 +-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
index 63d299d7..c0892f74 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
@@ -76,8 +76,8 @@ public enum Environment {
 //
 // System properties
 //
-/** Java home for starting the daemon */
-JAVA_HOME("java.home", "JAVA_HOME", null, OptionType.PATH, Flags.NONE),
+/** Java home for starting the daemon. */
+JAVA_HOME("java.home", "JAVA_HOME", null, OptionType.PATH, 
Flags.DOCUMENTED_AS_DISCRIMINATING),
 /**
  * The daemon installation directory. The client normally sets this 
according to where its mvnd
  * executable is located
@@ -346,7 +346,11 @@ public enum Environment {
 this.property = property;
 this.environmentVariable = environmentVariable;
 this.default_ = default_ != null ? default_.toString() : null;
-this.flags = flags;
+if ((flags & Flags.DISCRIMINATING) != 0) {
+this.flags = (flags | Flags.DOCUMENTED_AS_DISCRIMINATING);
+} else {
+this.flags = flags;
+}
 this.type = type;
 if (options.length == 0) {
 this.options = Collections.emptyMap();
@@ -400,6 +404,10 @@ public enum Environment {
 return (flags & Flags.DISCRIMINATING) != 0;
 }
 
+public boolean isDocumentedAsDiscriminating() {
+return (flags & Flags.DOCUMENTED_AS_DISCRIMINATING) != 0;
+}
+
 public boolean isInternal() {
 return (flags & Flags.INTERNAL) != 0;
 }
@@ -602,8 +610,15 @@ public enum Environment {
 
 static class Flags {
 private static final int NONE = 0b0;
+/**
+ * Implies {@link #DOCUMENTED_AS_DISCRIMINATING} - this is implemented 
in
+ * {@link Environment#Environment(String, String, Object, OptionType, 
int, String...)}
+ */
 private static final int DISCRIMINATING = 0b1;
+
 private static final int INTERNAL = 0b10;
 private static final int OPTIONAL = 0b100;
+/** Set automatically for entries having {@link #DISCRIMINATING} */
+private static final int DOCUMENTED_AS_DISCRIMINATING = 0b1000;
 }
 }
diff --git a/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java 
b/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
index f3c56268..95430aaa 100644
--- a/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
+++ b/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
@@ -121,7 +121,7 @@ public class MvndHelpFormatter {
 spaces(help, indentPos - help.length());
 wrap(help, toPlainText(entry.getJavaDoc()), terminalWidth, 
lineEnd, indent);
 
-if (env.isDiscriminating()) {
+if (env.isDocumentedAsDiscriminating()) {
 indentedLine(help, terminalWidth, "This is a discriminating 
start parameter.", indent);
 }
 if (env.getDefault() != null) {



[maven-mvnd] branch master updated (c177fe22 -> 7d9a39be)

2023-05-23 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


from c177fe22 {@link } JavaDoc refs missing in the output of mvnd --help
 new 82e42e6e Show which options are discriminating in the output of mvnd 
--help
 new 7d9a39be JAVA_HOME should be documented as discriminating #852

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/mvndaemon/mvnd/common/Environment.java | 21 +---
 .../org/apache/maven/cli/MvndHelpFormatter.java| 23 --
 2 files changed, 31 insertions(+), 13 deletions(-)



[maven-mvnd] 01/02: Show which options are discriminating in the output of mvnd --help

2023-05-23 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 82e42e6e64124bcc4e530ac9c802b99e05d34ff4
Author: Peter Palaga 
AuthorDate: Mon May 22 13:41:59 2023 +0200

Show which options are discriminating in the output of mvnd --help
---
 .../org/apache/maven/cli/MvndHelpFormatter.java| 23 --
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java 
b/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
index 271836b0..f3c56268 100644
--- a/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
+++ b/daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
@@ -121,8 +121,15 @@ public class MvndHelpFormatter {
 spaces(help, indentPos - help.length());
 wrap(help, toPlainText(entry.getJavaDoc()), terminalWidth, 
lineEnd, indent);
 
-indentedLine(help, terminalWidth, "Default", env.getDefault(), 
indent);
-indentedLine(help, terminalWidth, "Env. variable", 
env.getEnvironmentVariable(), indent);
+if (env.isDiscriminating()) {
+indentedLine(help, terminalWidth, "This is a discriminating 
start parameter.", indent);
+}
+if (env.getDefault() != null) {
+indentedLine(help, terminalWidth, "Default: " + 
env.getDefault(), indent);
+}
+if (env.getEnvironmentVariable() != null) {
+indentedLine(help, terminalWidth, "Env. variable: " + 
env.getEnvironmentVariable(), indent);
+}
 });
 
 help.append(lineSeparator).append(lineSeparator).append("mvnd value 
types:");
@@ -151,14 +158,10 @@ public class MvndHelpFormatter {
 return terminalWidth;
 }
 
-private static void indentedLine(
-StringBuilder stringBuilder, int terminalWidth, String key, String 
value, String indent) {
-int lineEnd;
-if (value != null) {
-lineEnd = stringBuilder.length() + terminalWidth;
-stringBuilder.append(System.lineSeparator()).append(indent);
-wrap(stringBuilder, key + ": " + value, terminalWidth, lineEnd, 
indent);
-}
+private static void indentedLine(StringBuilder stringBuilder, int 
terminalWidth, String text, String indent) {
+final int lineEnd = stringBuilder.length() + terminalWidth;
+stringBuilder.append(System.lineSeparator()).append(indent);
+wrap(stringBuilder, text, terminalWidth, lineEnd, indent);
 }
 
 /**



[maven-mvnd] branch master updated: {@link } JavaDoc refs missing in the output of mvnd --help

2023-05-22 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new c177fe22 {@link } JavaDoc refs missing in the output of mvnd --help
c177fe22 is described below

commit c177fe220eb620357e71993af888516ea475fe6e
Author: Peter Palaga 
AuthorDate: Sun May 21 21:14:21 2023 +0200

{@link } JavaDoc refs missing in the output of mvnd --help
---
 common/src/main/java/org/mvndaemon/mvnd/common/Environment.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
index 49d5e9a1..63d299d7 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
@@ -226,17 +226,17 @@ public enum Environment {
 MVND_CORE_EXTENSIONS("mvnd.coreExtensions", null, null, OptionType.STRING, 
Flags.DISCRIMINATING | Flags.INTERNAL),
 /**
  * The -Xms value to pass to the daemon.
- * This option takes precedence over options specified in {@link 
#MVND_JVM_ARGS}.
+ * This option takes precedence over options specified in 
-Dmvnd.jvmArgs.
  */
 MVND_MIN_HEAP_SIZE("mvnd.minHeapSize", null, null, OptionType.MEMORY_SIZE, 
Flags.DISCRIMINATING | Flags.OPTIONAL),
 /**
  * The -Xmx value to pass to the daemon.
- * This option takes precedence over options specified in {@link 
#MVND_JVM_ARGS}.
+ * This option takes precedence over options specified in 
-Dmvnd.jvmArgs.
  */
 MVND_MAX_HEAP_SIZE("mvnd.maxHeapSize", null, null, OptionType.MEMORY_SIZE, 
Flags.DISCRIMINATING | Flags.OPTIONAL),
 /**
  * The -Xss value to pass to the daemon.
- * This option takes precedence over options specified in {@link 
#MVND_JVM_ARGS}.
+ * This option takes precedence over options specified in 
-Dmvnd.jvmArgs.
  */
 MVND_THREAD_STACK_SIZE(
 "mvnd.threadStackSize", null, null, OptionType.MEMORY_SIZE, 
Flags.DISCRIMINATING | Flags.OPTIONAL),



[maven-mvnd] branch master updated: Add property to disable model caching

2023-03-02 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 0b55c8f3 Add property to disable model caching
0b55c8f3 is described below

commit 0b55c8f3e6f3937d253c3362e78ec540225c2baf
Author: Stefan Oehme 
AuthorDate: Sun Feb 26 18:10:14 2023 +0100

Add property to disable model caching

This is mostly for the integration tests of the Gradle Enterprise Maven 
extension,
which heavily test dependency resolution and reuse the same GAVs in many 
test,
e.g. a:b:1.0. It would be a lot of effort to rewrite all those tests and a 
shame
to restart the daemon every time. So I wanted to ask if you'd consider this 
flag
to disable the caching altogether.
---
 common/src/main/java/org/mvndaemon/mvnd/common/Environment.java   | 7 +++
 .../java/org/apache/maven/project/SnapshotModelCacheFactory.java  | 8 +++-
 dist/src/main/distro/bin/mvnd-bash-completion.bash| 2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
index 65dcddcc..49d5e9a1 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
@@ -163,6 +163,13 @@ public enum Environment {
  * non-native clients and is useful mostly for debugging.
  */
 MVND_NO_DAEMON("mvnd.noDaemon", "MVND_NO_DAEMON", Boolean.FALSE, 
OptionType.BOOLEAN, Flags.DISCRIMINATING),
+
+/**
+ * If true, the daemon will not use its in-memory metadata 
cache and instead re-read the
+ * metadata from the pom.xml files in the local repository. This is mostly 
useful for testing purposes.
+ */
+MVND_NO_MODEL_CACHE("mvnd.noModelCache", null, Boolean.FALSE, 
OptionType.BOOLEAN, Flags.OPTIONAL),
+
 /**
  * If true, the daemon will be launched in debug mode with 
the following JVM argument:
  * 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000;
 otherwise the debug argument is
diff --git 
a/daemon/src/main/java/org/apache/maven/project/SnapshotModelCacheFactory.java 
b/daemon/src/main/java/org/apache/maven/project/SnapshotModelCacheFactory.java
index a070c7c5..fe285af6 100644
--- 
a/daemon/src/main/java/org/apache/maven/project/SnapshotModelCacheFactory.java
+++ 
b/daemon/src/main/java/org/apache/maven/project/SnapshotModelCacheFactory.java
@@ -29,6 +29,8 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.sisu.Priority;
 
+import static org.mvndaemon.mvnd.common.Environment.MVND_NO_MODEL_CACHE;
+
 @Singleton
 @Named
 @Priority(10)
@@ -45,6 +47,10 @@ public class SnapshotModelCacheFactory implements 
ModelCacheFactory {
 
 @Override
 public ModelCache createCache(RepositorySystemSession session) {
-return new SnapshotModelCache(globalCache, 
factory.createCache(session));
+boolean noModelCache =
+
Boolean.parseBoolean(MVND_NO_MODEL_CACHE.asOptional().orElse(MVND_NO_MODEL_CACHE.getDefault()));
+ModelCache reactorCache = factory.createCache(session);
+ModelCache globalCache = noModelCache ? reactorCache : 
this.globalCache;
+return new SnapshotModelCache(globalCache, reactorCache);
 }
 }
diff --git a/dist/src/main/distro/bin/mvnd-bash-completion.bash 
b/dist/src/main/distro/bin/mvnd-bash-completion.bash
index 50f77891..0dde19ff 100755
--- a/dist/src/main/distro/bin/mvnd-bash-completion.bash
+++ b/dist/src/main/distro/bin/mvnd-bash-completion.bash
@@ -218,7 +218,7 @@ _mvnd()
 
 local mvnd_opts="-1"
 local 
mvnd_long_opts="--color|--completion|--purge|--raw-streams|--serial|--status|--stop"
-local 
mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAl
 [...]
+local 
mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dm

[maven-mvnd] 02/02: Publish the binaries produced by the Early Access job again

2023-01-17 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 5cd0f754d58ec213d19e5e95f40ac15ec4f36e05
Author: Peter Palaga 
AuthorDate: Tue Jan 17 11:13:43 2023 +0100

Publish the binaries produced by the Early Access job again
---
 .github/workflows/early-access.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/early-access.yaml 
b/.github/workflows/early-access.yaml
index 865331c8..6ea62920 100644
--- a/.github/workflows/early-access.yaml
+++ b/.github/workflows/early-access.yaml
@@ -88,4 +88,4 @@ jobs:
 uses: actions/upload-artifact@v2
 with:
   name: mvnd-${{ env.OS }}
-  path: dist/target/mvnd-*.zip
+  path: dist/target/maven-mvnd-*.zip



[maven-mvnd] 01/02: Exclude test and cache filed from apache-rat-plugin checks

2023-01-17 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 8d161dcf76cb18336b9010aebedeabdec4cec32a
Author: Peter Palaga 
AuthorDate: Tue Jan 17 11:12:11 2023 +0100

Exclude test and cache filed from apache-rat-plugin checks
---
 pom.xml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/pom.xml b/pom.xml
index f24912b3..3551f5d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -346,9 +346,14 @@
   **/*.png
   **/*.json
   **/.mvn/*
+  .cache/**
   .mvn/**/*
   *.adoc
   *.md
+  src/test/projects/**/.classpath
+  src/test/projects/**/.project
+  src/test/projects/**/.settings/**
+  src/test/projects/**/target/**
 
   
 



[maven-mvnd] branch master updated (74df4b6b -> 5cd0f754)

2023-01-17 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


from 74df4b6b Fix core export provider (#764)
 new 8d161dcf Exclude test and cache filed from apache-rat-plugin checks
 new 5cd0f754 Publish the binaries produced by the Early Access job again

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/early-access.yaml | 2 +-
 pom.xml | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)



[maven-mvnd] branch master updated: Add more discriminating properties to the daemon

2022-12-08 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 866a7c6f Add more discriminating properties to the daemon
866a7c6f is described below

commit 866a7c6f3f05355e159920d88d75096129de7c53
Author: Stefan Oehme 
AuthorDate: Wed Dec 7 17:01:26 2022 +0100

Add more discriminating properties to the daemon

The local repo and maven settings are both used while resolving core 
extensions,
which happens during daemon startup. Thus these two also need to be 
discriminating
properties, as the core extensions themselves are discriminating.
---
 .../src/main/java/org/mvndaemon/mvnd/common/Environment.java  | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
index 6181dc9c..9149eb8f 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
@@ -94,9 +94,16 @@ public enum Environment {
 // Maven properties
 //
 /** The path to the Maven local repository */
-MAVEN_REPO_LOCAL("maven.repo.local", null, null, OptionType.PATH, 
Flags.NONE),
+MAVEN_REPO_LOCAL("maven.repo.local", null, null, OptionType.PATH, 
Flags.DISCRIMINATING | Flags.OPTIONAL),
 /** The location of the maven settings file */
-MAVEN_SETTINGS("maven.settings", null, null, OptionType.PATH, Flags.NONE, 
"mvn:-s", "mvn:--settings"),
+MAVEN_SETTINGS(
+"maven.settings",
+null,
+null,
+OptionType.PATH,
+Flags.DISCRIMINATING | Flags.OPTIONAL,
+"mvn:-s",
+"mvn:--settings"),
 /** The pom or directory to build */
 MAVEN_FILE(null, null, null, OptionType.PATH, Flags.NONE, "mvn:-f", 
"mvn:--file"),
 /** The root directory of the current multi module Maven project */



[maven-enforcer] branch master updated (ae93fa8 -> b66d4f2)

2022-08-19 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git


from ae93fa8  [MENFORCER-397] allow no rules
 add b66d4f2  [MENFORCER-422] Added externalRules rule

No new revisions were added by this update.

Summary of changes:
 .gitignore |   2 +-
 .../plugins/enforcer/EnforcerDescriptor.java}  |  26 ++--
 .../maven/plugins/enforcer/ExternalRules.java  | 152 +
 enforcer-rules/src/site/apt/externalRules.apt.vm   | 100 ++
 enforcer-rules/src/site/apt/index.apt  |   2 +
 .../maven/plugins/enforcer/EnforcerTestUtils.java  |  16 ++-
 .../maven/plugins/enforcer/TestExternalRules.java  |  56 
 .../src/test/resources/enforcer-rules/pass.xml |  13 +-
 .../external-rules-always-fail/enforcer-rules.xml  |  13 +-
 .../invoker.properties |   0
 .../pom.xml|   4 +-
 .../external-rules-always-pass/enforcer-rules.xml  |  13 +-
 .../pom.xml|   4 +-
 pom.xml|   4 +
 14 files changed, 365 insertions(+), 40 deletions(-)
 copy 
enforcer-rules/src/{test/java/org/apache/maven/plugins/enforcer/TestAlwaysPass.java
 => main/java/org/apache/maven/plugins/enforcer/EnforcerDescriptor.java} (68%)
 create mode 100644 
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ExternalRules.java
 create mode 100644 enforcer-rules/src/site/apt/externalRules.apt.vm
 create mode 100644 
enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestExternalRules.java
 copy maven-enforcer-extension/src/it/projects/defaults/pom.xml => 
enforcer-rules/src/test/resources/enforcer-rules/pass.xml (82%)
 copy maven-enforcer-extension/src/it/projects/defaults/pom.xml => 
maven-enforcer-plugin/src/it/projects/external-rules-always-fail/enforcer-rules.xml
 (82%)
 copy maven-enforcer-plugin/src/it/projects/{always-fail => 
external-rules-always-fail}/invoker.properties (100%)
 copy maven-enforcer-plugin/src/it/projects/{always-fail => 
external-rules-always-fail}/pom.xml (92%)
 copy maven-enforcer-extension/src/it/projects/defaults/pom.xml => 
maven-enforcer-plugin/src/it/projects/external-rules-always-pass/enforcer-rules.xml
 (82%)
 copy maven-enforcer-plugin/src/it/projects/{always-fail => 
external-rules-always-pass}/pom.xml (92%)



[maven-mvnd] branch master updated: Update RELEASING.adoc

2022-05-04 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new c3612be  Update RELEASING.adoc
c3612be is described below

commit c3612be87eedac16826572e831618291b777213e
Author: Delany 
AuthorDate: Wed May 4 15:13:28 2022 +0200

Update RELEASING.adoc
---
 RELEASING.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RELEASING.adoc b/RELEASING.adoc
index 4e93c5d..e5ccc02 100644
--- a/RELEASING.adoc
+++ b/RELEASING.adoc
@@ -1,4 +1,4 @@
-= How to release `mnvd`
+= How to release `mvnd`
 
 * Run the 
https://raw.githubusercontent.com/apache/maven-mvnd/master/build/release.sh[release
 script] which will update the versions, the changelog, the native binaries and 
will tag the new git commit. This new tag will trigger the 
https://raw.githubusercontent.com/apache/maven-mvnd/master/.github/workflows/release.yaml[release
 workflow] on this newly created tag.
 [source,shell]



[maven-mvnd] branch master updated: Fix typos in readme

2022-04-22 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
 new 0f86f13  Fix typos in readme
0f86f13 is described below

commit 0f86f1399743f379008fbd08b2a0060e352a72c1
Author: Michael Keppler 
AuthorDate: Fri Apr 22 16:40:55 2022 +0200

Fix typos in readme
---
 README.adoc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.adoc b/README.adoc
index 89286f8..ad9da7a 100644
--- a/README.adoc
+++ b/README.adoc
@@ -37,12 +37,12 @@ This architecture brings the following advantages:
   given by the formula `Math.max(Runtime.getRuntime().availableProcessors() - 
1, 1)`. If your source tree does not
   support parallel builds, pass `-T1` on the command line to make your build 
serial.
 * Improved console output: we believe that the output of a parallel build on a 
stock Maven is hard to follow. Therefore,
-we implemented a simplified a non-rolling view showing the status of each 
build thread on a separate line. This is
+we implemented a simplified non-rolling view showing the status of each build 
thread on a separate line. This is
 what it looks like on a machine with 24 cores:
 +
 
image::https://user-images.githubusercontent.com/1826249/103917178-94ee4500-510d-11eb-9abb-f52dae58a544.gif[]
 +
-Once the build is finshed, the complete Maven output is forwarded to the 
console.
+Once the build is finished, the complete Maven output is forwarded to the 
console.
 
 == How to install `mvnd`
 
@@ -218,6 +218,6 @@ $ ls -lh target/mvnd
 $ cp -R dist/target/mvnd-[version] [target-dir]
 
 
-Then you can simply run add `[target-dir]/bin` to your `PATH` and run `mvnd`. 
+Then you can simply add `[target-dir]/bin` to your `PATH` and run `mvnd`. 
 
-We're happy to improve `mvnd`, so 
https://github.com/mvndaemon/mvnd/issues[feedback] is most welcomed!
+We're happy to improve `mvnd`, so 
https://github.com/mvndaemon/mvnd/issues[feedback] is most welcome!



[maven-mvnd] 01/02: Make `DaemonRegistry.getProcessId0` more robust

2022-03-22 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 86d1c3661b3e94f6fc8727195851984b2ad7bf1d
Author: Jesse Glick 
AuthorDate: Tue Mar 22 09:30:46 2022 -0400

Make `DaemonRegistry.getProcessId0` more robust
---
 .../org/mvndaemon/mvnd/common/DaemonRegistry.java  | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
index ab414dc..7fcf21c 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
@@ -271,23 +271,33 @@ public class DaemonRegistry implements AutoCloseable {
 private static final int PROCESS_ID = getProcessId0();
 
 private static int getProcessId0() {
-String pid = null;
 try {
 final Path self = Paths.get("/proc/self");
 if (Files.exists(self)) {
-pid = self.toRealPath().getFileName().toString();
+String pid = self.toRealPath().getFileName().toString();
+if (pid.equals("self")) {
+LOGGER.debug("/proc/self symlink could not be followed");
+} else {
+LOGGER.debug("loading own PID from /proc/self link: {}", 
pid);
+try {
+return Integer.parseInt(pid);
+} catch (NumberFormatException x) {
+LOGGER.warn("Unable to determine PID from malformed 
/proc/self link `" + pid + "`");
+}
+}
 }
 } catch (IOException ignored) {
+LOGGER.debug("could not load /proc/self", ignored);
 }
-if (pid == null) {
-pid = ManagementFactory.getRuntimeMXBean().getName().split("@", 
0)[0];
-}
-if (pid == null) {
+String vmname = ManagementFactory.getRuntimeMXBean().getName();
+String pid = vmname.split("@", 0)[0];
+LOGGER.debug("loading own PID from VM name: {}", pid);
+try {
+return Integer.parseInt(pid);
+} catch (NumberFormatException x) {
 int rpid = new Random().nextInt(1 << 16);
-LOGGER.warn("Unable to determine PID, picked a random number=" + 
rpid);
+LOGGER.warn("Unable to determine PID from malformed VM name `" + 
vmname + "`, picked a random number=" + rpid);
 return rpid;
-} else {
-return Integer.parseInt(pid);
 }
 }
 


[maven-mvnd] branch master updated (3b10083 -> 2ab4cd8)

2022-03-22 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git.


from 3b10083  Fix mvn/bin/mvn debug output (#606)
 new 86d1c36  Make `DaemonRegistry.getProcessId0` more robust
 new 2ab4cd8  Only check `/proc/self` if apparently on Linux (always fall 
back to VM name)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/mvndaemon/mvnd/common/DaemonRegistry.java  | 38 ++
 1 file changed, 25 insertions(+), 13 deletions(-)


[maven-mvnd] 02/02: Only check `/proc/self` if apparently on Linux (always fall back to VM name)

2022-03-22 Thread ppalaga
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit 2ab4cd80831e9de88d4ef752787aecdc4d2b815f
Author: Jesse Glick 
AuthorDate: Tue Mar 22 14:41:11 2022 -0400

Only check `/proc/self` if apparently on Linux (always fall back to VM name)
---
 .../org/mvndaemon/mvnd/common/DaemonRegistry.java  | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
index 7fcf21c..5d3d7a8 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/DaemonRegistry.java
@@ -271,23 +271,25 @@ public class DaemonRegistry implements AutoCloseable {
 private static final int PROCESS_ID = getProcessId0();
 
 private static int getProcessId0() {
-try {
-final Path self = Paths.get("/proc/self");
-if (Files.exists(self)) {
-String pid = self.toRealPath().getFileName().toString();
-if (pid.equals("self")) {
-LOGGER.debug("/proc/self symlink could not be followed");
-} else {
-LOGGER.debug("loading own PID from /proc/self link: {}", 
pid);
-try {
-return Integer.parseInt(pid);
-} catch (NumberFormatException x) {
-LOGGER.warn("Unable to determine PID from malformed 
/proc/self link `" + pid + "`");
+if (Os.current() == Os.LINUX) {
+try {
+final Path self = Paths.get("/proc/self");
+if (Files.exists(self)) {
+String pid = self.toRealPath().getFileName().toString();
+if (pid.equals("self")) {
+LOGGER.debug("/proc/self symlink could not be 
followed");
+} else {
+LOGGER.debug("loading own PID from /proc/self link: 
{}", pid);
+try {
+return Integer.parseInt(pid);
+} catch (NumberFormatException x) {
+LOGGER.warn("Unable to determine PID from 
malformed /proc/self link `" + pid + "`");
+}
 }
 }
+} catch (IOException ignored) {
+LOGGER.debug("could not load /proc/self", ignored);
 }
-} catch (IOException ignored) {
-LOGGER.debug("could not load /proc/self", ignored);
 }
 String vmname = ManagementFactory.getRuntimeMXBean().getName();
 String pid = vmname.split("@", 0)[0];