You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/05/02 11:13:12 UTC
[maven-mvnd] branch master updated: Move BuildProperties to the client (#630)
This is an automated email from the ASF dual-hosted git repository.
gnodet 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 ff7bbbe Move BuildProperties to the client (#630)
ff7bbbe is described below
commit ff7bbbe458c2eba4ac8615754f68791e45f8453c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon May 2 13:13:07 2022 +0200
Move BuildProperties to the client (#630)
---
client/pom.xml | 15 +++++++++++++++
.../mvndaemon/mvnd/client}/BuildProperties.java | 2 +-
.../mvndaemon/mvnd/client/DaemonParameters.java | 1 -
.../org/mvndaemon/mvnd/client/DefaultClient.java | 10 ++++------
.../org/mvndaemon/mvnd/client}/build.properties | 1 -
common/pom.xml | 22 ----------------------
.../org/mvndaemon/mvnd/it/VersionNativeIT.java | 9 ++++++---
7 files changed, 26 insertions(+), 34 deletions(-)
diff --git a/client/pom.xml b/client/pom.xml
index 76b08f8..3fa6d91 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -74,6 +74,21 @@
</resource>
</resources>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <configuration>
+ <locale>en_US</locale>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>io.takari.maven.plugins</groupId>
<artifactId>takari-lifecycle-plugin</artifactId>
diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/BuildProperties.java b/client/src/main/java/org/mvndaemon/mvnd/client/BuildProperties.java
similarity index 98%
rename from common/src/main/java/org/mvndaemon/mvnd/common/BuildProperties.java
rename to client/src/main/java/org/mvndaemon/mvnd/client/BuildProperties.java
index 40b11a8..8282b98 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/BuildProperties.java
+++ b/client/src/main/java/org/mvndaemon/mvnd/client/BuildProperties.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.mvndaemon.mvnd.common;
+package org.mvndaemon.mvnd.client;
import java.io.IOException;
import java.io.InputStream;
diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java
index eefdbc7..08b02b5 100644
--- a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java
+++ b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonParameters.java
@@ -41,7 +41,6 @@ import org.apache.maven.cli.internal.extension.model.CoreExtension;
import org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.mvndaemon.mvnd.common.BuildProperties;
import org.mvndaemon.mvnd.common.Environment;
import org.mvndaemon.mvnd.common.Os;
import org.mvndaemon.mvnd.common.SocketFamily;
diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java
index f1e88e8..7a4759a 100644
--- a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java
+++ b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java
@@ -39,7 +39,6 @@ import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.internal.CLibrary;
import org.jline.utils.AttributedString;
import org.jline.utils.AttributedStyle;
-import org.mvndaemon.mvnd.common.BuildProperties;
import org.mvndaemon.mvnd.common.DaemonException;
import org.mvndaemon.mvnd.common.DaemonInfo;
import org.mvndaemon.mvnd.common.DaemonRegistry;
@@ -187,11 +186,10 @@ public class DefaultClient implements Client {
if (version || showVersion || debug) {
// Print mvnd version
BuildProperties buildProperties = BuildProperties.getInstance();
- final String mvndVersionString = "mvnd "
- + (Environment.isNative() ? "native client " : "JVM client ")
- + buildProperties.getVersion()
- + "-" + buildProperties.getOsName()
- + "-" + buildProperties.getOsArch()
+ final String mvndVersionString = "mvnd " + buildProperties.getVersion() + " "
+ + (Environment.isNative()
+ ? buildProperties.getOsName() + "-" + buildProperties.getOsArch() + " native client"
+ : "JVM client")
+ " (" + buildProperties.getRevision() + ")";
boolean isColored = !"never".equals(Environment.MAVEN_COLOR.getCommandLineOption(args));
diff --git a/common/src/main/resources/org/mvndaemon/mvnd/common/build.properties b/client/src/main/resources/org/mvndaemon/mvnd/client/build.properties
similarity index 93%
rename from common/src/main/resources/org/mvndaemon/mvnd/common/build.properties
rename to client/src/main/resources/org/mvndaemon/mvnd/client/build.properties
index d643a40..3f441a5 100644
--- a/common/src/main/resources/org/mvndaemon/mvnd/common/build.properties
+++ b/client/src/main/resources/org/mvndaemon/mvnd/client/build.properties
@@ -16,7 +16,6 @@
# under the License.
revision=${buildNumber}
-timestamp=${timestamp}
version=${project.version}
os.detected.name=${os.detected.name}
os.detected.arch=${os.detected.arch}
\ No newline at end of file
diff --git a/common/pom.xml b/common/pom.xml
index f740ed0..6d9ff7b 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -59,29 +59,7 @@
</dependencies>
<build>
- <resources>
- <resource>
- <directory>${basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
<plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <configuration>
- <locale>en_US</locale>
- <timestampFormat>{0,date,yyyy-MM-dd'T'HH:mm:ssX}</timestampFormat>
- </configuration>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.mvndaemon.mvnd</groupId>
<artifactId>mvnd-build-maven-plugin</artifactId>
diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/VersionNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/VersionNativeIT.java
index 80eccc3..a531080 100644
--- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/VersionNativeIT.java
+++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/VersionNativeIT.java
@@ -40,10 +40,13 @@ public class VersionNativeIT {
client.execute(output, "-v").assertSuccess();
output.assertContainsMatchingSubsequence(
- "\\Qmvnd " + (isNative() ? "native client " : "JVM client ")
+ "\\Qmvnd "
+ System.getProperty("project.version")
- + "-" + System.getProperty("os.detected.name")
- + "-" + System.getProperty("os.detected.arch")
+ + " "
+ + (isNative()
+ ? System.getProperty("os.detected.name")
+ + "-" + System.getProperty("os.detected.arch") + " native client"
+ : "JVM client")
+ "\\E",
"\\QMaven home: " + parameters.mvndHome() + "\\E");
}