Skip to content

Conversation

@czpilar
Copy link
Contributor

@czpilar czpilar commented Jan 25, 2026

Resolves #1286

Signed-off-by: czpilar <david@czpilar.net>
@czpilar
Copy link
Contributor Author

czpilar commented Jan 25, 2026

I've created records BuildProperties and GitProperties within Version command to avoid adding spring-boot dependency to spring-shell-core.

@fmbenhassine
Copy link
Contributor

LGTM! However, this will only work with Spring Boot right? I am thinking about non boot users.

Moreover, I can't seem to get build and git details when testing the change set. Here are the changes I tried on the Boot sample:

Index: spring-shell-samples/spring-shell-sample-spring-boot/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/spring-shell-samples/spring-shell-sample-spring-boot/pom.xml b/spring-shell-samples/spring-shell-sample-spring-boot/pom.xml
--- a/spring-shell-samples/spring-shell-sample-spring-boot/pom.xml	(revision e7a56eedeec72f95fd14b677e3d8fc9b355ea008)
+++ b/spring-shell-samples/spring-shell-sample-spring-boot/pom.xml	(date 1769592876333)
@@ -26,4 +26,24 @@
         </dependency>
 	</dependencies>
 
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>repackage</goal>
+						</goals>
+						<configuration>
+							<mainClass>org.springframework.shell.samples.helloworld.boot.SpringShellApplication</mainClass>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
 </project>
Index: spring-shell-samples/spring-shell-sample-spring-boot/src/main/resources/application.properties
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
diff --git a/spring-shell-samples/spring-shell-sample-spring-boot/src/main/resources/application.properties b/spring-shell-samples/spring-shell-sample-spring-boot/src/main/resources/application.properties
--- a/spring-shell-samples/spring-shell-sample-spring-boot/src/main/resources/application.properties	(revision e7a56eedeec72f95fd14b677e3d8fc9b355ea008)
+++ b/spring-shell-samples/spring-shell-sample-spring-boot/src/main/resources/application.properties	(date 1769593001068)
@@ -1,1 +1,11 @@
-spring.application.name=spring-shell-hello-world
\ No newline at end of file
+spring.application.name=spring-shell-hello-world
+spring.shell.command.version.show-build-artifact=true
+spring.shell.command.version.show-build-group=true
+spring.shell.command.version.show-build-version=true
+spring.shell.command.version.show-build-time=true
+spring.shell.command.version.show-build-name=true
+
+spring.shell.command.version.show-git-branch=true
+spring.shell.command.version.show-git-commit-time=true
+spring.shell.command.version.show-git-commit-id=true
+spring.shell.command.version.show-git-short-commit-id=true
\ No newline at end of file

Building a jar file and running it with java -jar target/spring-shell-sample-spring-boot-4.0.1-SNAPSHOT.jar does not show the details when I run the version command. I might be missing something or a config on how these details are gathered by Boot.

@fmbenhassine fmbenhassine added the status/need-feedback Calling participant to provide feedback label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-feedback Calling participant to provide feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore version command result as in v3

2 participants