Skip to content

Commit 4a8f692

Browse files
holdenkdbtsai
authored andcommitted
[SPARK-32397][BUILD] Allow specifying of time for build to keep time consistent between modules
### What changes were proposed in this pull request? Upgrade codehaus maven build helper to allow people to specify a time during the build to avoid snapshot artifacts with different version strings. ### Why are the changes needed? During builds of snapshots the maven may assign different versions to different artifacts based on the time each individual sub-module starts building. The timestamp is used as part of the version string when run `maven deploy` on a snapshot build. This results in different sub-modules having different version strings. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manual build while specifying the current time, ensured the time is consistent in the sub components. Open question: Ideally I'd like to backport this as well since it's sort of a bug fix and while it does change a dependency version it's not one that is propagated. I'd like to hear folks thoughts about this. Closes #29274 from holdenk/SPARK-32397-snapshot-artifact-timestamp-differences. Authored-by: Holden Karau <[email protected]> Signed-off-by: DB Tsai <[email protected]> (cherry picked from commit 50911df) Signed-off-by: DB Tsai <[email protected]>
1 parent c1421d0 commit 4a8f692

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

pom.xml

+35-5
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@
228228
<spark.test.home>${session.executionRootDirectory}</spark.test.home>
229229

230230
<CodeCacheSize>1g</CodeCacheSize>
231+
<!-- Needed for consistent times -->
232+
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss z</maven.build.timestamp.format>
231233
</properties>
232234
<repositories>
233235
<repository>
@@ -2107,11 +2109,39 @@
21072109
</execution>
21082110
</executions>
21092111
</plugin>
2110-
<plugin>
2111-
<groupId>org.codehaus.mojo</groupId>
2112-
<artifactId>build-helper-maven-plugin</artifactId>
2113-
<version>3.0.0</version>
2114-
</plugin>
2112+
<plugin>
2113+
<groupId>org.codehaus.mojo</groupId>
2114+
<artifactId>build-helper-maven-plugin</artifactId>
2115+
<version>3.2.0</version>
2116+
<executions>
2117+
<execution>
2118+
<id>module-timestamp-property</id>
2119+
<phase>validate</phase>
2120+
<goals>
2121+
<goal>timestamp-property</goal>
2122+
</goals>
2123+
<configuration>
2124+
<name>module.build.timestamp</name>
2125+
<pattern>${maven.build.timestamp.format}</pattern>
2126+
<timeSource>current</timeSource>
2127+
<timeZone>America/Los_Angeles</timeZone>
2128+
</configuration>
2129+
</execution>
2130+
<execution>
2131+
<id>local-timestamp-property</id>
2132+
<phase>validate</phase>
2133+
<goals>
2134+
<goal>timestamp-property</goal>
2135+
</goals>
2136+
<configuration>
2137+
<name>local.build.timestamp</name>
2138+
<pattern>${maven.build.timestamp.format}</pattern>
2139+
<timeSource>build</timeSource>
2140+
<timeZone>America/Los_Angeles</timeZone>
2141+
</configuration>
2142+
</execution>
2143+
</executions>
2144+
</plugin>
21152145
<plugin>
21162146
<groupId>net.alchim31.maven</groupId>
21172147
<artifactId>scala-maven-plugin</artifactId>

0 commit comments

Comments
 (0)