This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-graalvm-distro.git


The following commit(s) were added to refs/heads/main by this push:
     new 5ab4d71  Fix source tarball build: move version.properties generation 
to git-only profile (#16)
5ab4d71 is described below

commit 5ab4d7165bd71f72c9c8464da95adc1501e72cf2
Author: 吴晟 Wu Sheng <[email protected]>
AuthorDate: Tue Mar 17 11:45:04 2026 +0800

    Fix source tarball build: move version.properties generation to git-only 
profile (#16)
---
 oap-graalvm-server/pom.xml | 91 +++++++++++++++++++++++++++-------------------
 1 file changed, 54 insertions(+), 37 deletions(-)

diff --git a/oap-graalvm-server/pom.xml b/oap-graalvm-server/pom.xml
index cc29695..03ded8c 100644
--- a/oap-graalvm-server/pom.xml
+++ b/oap-graalvm-server/pom.xml
@@ -448,43 +448,6 @@
                             </target>
                         </configuration>
                     </execution>
-                    <!-- Copy version.properties from submodule, patch version 
for graal-distro.
-                         If version has -SNAPSHOT, replace it with the short 
commit ID.
-                         e.g. 10.4.0-SNAPSHOT -> 10.4.0-b537891-graal-distro
-                         Release versions just get the suffix: 10.4.0 -> 
10.4.0-graal-distro -->
-                    <execution>
-                        <id>copy-version-properties</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <target>
-                                <!-- Generate version.properties from 
submodule git metadata.
-                                     Does not depend on upstream's 
git-commit-id-plugin output. -->
-                                <exec executable="git" 
dir="${project.basedir}/../skywalking"
-                                      outputproperty="upstream.git.commit.id" 
failonerror="false">
-                                    <arg value="rev-parse"/>
-                                    <arg value="HEAD"/>
-                                </exec>
-                                <loadresource 
property="upstream.git.commit.id.short">
-                                    <string value="${upstream.git.commit.id}"/>
-                                    <filterchain>
-                                        <replaceregex pattern="^(.{7}).*$" 
replace="\1"/>
-                                    </filterchain>
-                                </loadresource>
-                                <!-- Build version: replace -SNAPSHOT with 
-<short-commit>, then append -graal-distro -->
-                                <loadresource 
property="upstream.build.version">
-                                    <string value="${skywalking.version}"/>
-                                    <filterchain>
-                                        <replaceregex pattern="-SNAPSHOT$" 
replace="-${upstream.git.commit.id.short}"/>
-                                    </filterchain>
-                                </loadresource>
-                                <echo 
file="${project.build.outputDirectory}/version.properties"
-                                      message="#Generated by 
skywalking-graalvm-distro${line.separator}git.build.version=${upstream.build.version}-graal-distro${line.separator}git.commit.id=${upstream.git.commit.id}${line.separator}"/>
-                            </target>
-                        </configuration>
-                    </execution>
                 </executions>
             </plugin>
             <!-- Assemble distribution folder: bin/ + config/ + libs/ + 
VERSION -->
@@ -511,4 +474,58 @@
             </plugin>
         </plugins>
     </build>
+
+    <profiles>
+        <!-- Generate version.properties from submodule git metadata.
+             Only active when .git exists (skipped for Apache source tarball 
builds,
+             where release.sh pre-generates the file in src/main/resources/). 
-->
+        <profile>
+            <id>git-version</id>
+            <activation>
+                <file>
+                    <exists>${basedir}/../.git</exists>
+                </file>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>copy-version-properties</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <target>
+                                        <exec executable="git" 
dir="${project.basedir}/../skywalking"
+                                              
outputproperty="upstream.git.commit.id" failonerror="true">
+                                            <arg value="rev-parse"/>
+                                            <arg value="HEAD"/>
+                                        </exec>
+                                        <loadresource 
property="upstream.git.commit.id.short">
+                                            <string 
value="${upstream.git.commit.id}"/>
+                                            <filterchain>
+                                                <replaceregex 
pattern="^(.{7}).*$" replace="\1"/>
+                                            </filterchain>
+                                        </loadresource>
+                                        <loadresource 
property="upstream.build.version">
+                                            <string 
value="${skywalking.version}"/>
+                                            <filterchain>
+                                                <replaceregex 
pattern="-SNAPSHOT$" replace="-${upstream.git.commit.id.short}"/>
+                                            </filterchain>
+                                        </loadresource>
+                                        <echo 
file="${project.build.outputDirectory}/version.properties"
+                                              message="#Generated by 
skywalking-graalvm-distro${line.separator}git.build.version=${upstream.build.version}-graal-distro${line.separator}git.commit.id=${upstream.git.commit.id}${line.separator}"/>
+                                    </target>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file

Reply via email to