You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/03/01 19:52:45 UTC
[PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
kwin opened a new pull request, #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624
The new Velocity property "scmModifiedDate" is receiving the value. Site descriptor has new format settings for "modificationDate" similar to the existing "publishDate" to affect rendering in supporting Skins.
This closes #279
Following this checklist to help us incorporate your
contribution quickly and easily:
- [ ] Your pull request should address just one issue, without pulling in other changes.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
Note that commits might be squashed by a maintainer on merge.
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
This may not always be possible but is a best-practice.
- [ ] Run `mvn verify` to make sure basic checks pass.
A more thorough check will be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#issuecomment-4147739028
Superseded by #627
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#issuecomment-4060417536
> I am wondering whether this should rather be a dedicated optional module (leveraging some SPI), otherwise everyone suffers from the dependency chain (even if not using this functionality). There is some complaints about m-site-p already being way too big in terms of dependencies ([apache/maven#11759](https://github.com/apache/maven/issues/11759)) even without this.
I agree with you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#issuecomment-3985295345
> Can this break site build reproducibility I have tried to introduce here and with Maven Site Tools using `maven.build.outputTimestamp`?
This is opt-in only. It falls back to the according velocity property "scmModified" not being set at all if SCM info is not available. If it is available, it should be the same no matter who rebuilds it, so overall I would say no. I cannot imagine a case where `scmModified` is available but different when you try to reproduce a build.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#issuecomment-4060208467
I am wondering whether this should rather be a dedicated optional module (leveraging some SPI), otherwise everyone suffers from the dependency chain (even if not using this functionality). There is some complaints about m-site-p already being way too big in terms of dependencies (https://github.com/apache/maven/issues/11759) even without this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin closed pull request #624: Expose SCM last modification date from Markup source in Velocity
URL: https://github.com/apache/maven-doxia-sitetools/pull/624
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#issuecomment-3980937782
Can this break site build reproducibility I have tried to introduce here and with Maven Site Tools using `maven.build.outputTimestamp`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#discussion_r2900750513
##########
doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java:
##########
@@ -334,8 +353,11 @@ void velocityToolManager() throws Exception {
siteRenderingContext.setTemplateProperties(attributes);
siteRenderingContext.setTemplateName("org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm");
- DocumentRenderingContext docRenderingContext =
- new DocumentRenderingContext(new File(""), "document.html", "generator");
+
+ InfoItem infoItem = Mockito.mock(InfoItem.class);
+ Mockito.when(infoItem.getLastChangedDateTime()).thenReturn(OffsetDateTime.parse("2024-06-01T12:00:00Z"));
Review Comment:
Why not use Instant here?
##########
doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java:
##########
@@ -589,6 +660,23 @@ protected Context createDocumentVelocityContext(
context.put("alignedFilePath", alignedFilePath);
// TODO Deprecated -- will be removed!
context.put("alignedFileName", alignedFilePath);
+
+ if (docRenderingContext.getScmInfo() != null) {
+ if (docRenderingContext.getScmInfo().getLastChangedDateTime() != null) {
+ // Velocity can only deal with Date/Calendar
+ Date scmModifiedDate = Date.from(docRenderingContext
+ .getScmInfo()
+ .getLastChangedDateTime()
+ .toInstant());
+ context.put("scmModifiedDate", scmModifiedDate);
+ } else {
+ LOGGER.warn(
+ "SCM info for file {} does not contain last modification date",
+ docRenderingContext.getInputPath());
+ }
+ } else {
+ LOGGER.debug("No SCM info available for file {}", docRenderingContext.getInputPath());
Review Comment:
`'{}'`
##########
doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java:
##########
@@ -589,6 +660,23 @@ protected Context createDocumentVelocityContext(
context.put("alignedFilePath", alignedFilePath);
// TODO Deprecated -- will be removed!
context.put("alignedFileName", alignedFilePath);
+
+ if (docRenderingContext.getScmInfo() != null) {
+ if (docRenderingContext.getScmInfo().getLastChangedDateTime() != null) {
+ // Velocity can only deal with Date/Calendar
+ Date scmModifiedDate = Date.from(docRenderingContext
+ .getScmInfo()
+ .getLastChangedDateTime()
+ .toInstant());
+ context.put("scmModifiedDate", scmModifiedDate);
+ } else {
+ LOGGER.warn(
+ "SCM info for file {} does not contain last modification date",
Review Comment:
`'{}'`
##########
doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java:
##########
@@ -672,7 +760,11 @@ protected Context createSiteTemplateVelocityContext(
context.put("bodyContent", content.getBody());
// document date (got from Doxia Sink date() API)
- context.put("documentDate", content.getDate());
+ if (content.getDate() != null) {
+ context.put("documentDate", content.getDate());
+ } else {
+ context.put("documentDate", context.get("scmModifiedDate"));
+ }
Review Comment:
Seems to be OK: The date specified in the source document: semantics has to be chosen by document writer (document creation date, or document last modification date, or ...), and format is not enforced.
https://maven.apache.org/doxia/doxia-sitetools/doxia-site-renderer/#site-template
##########
doxia-site-renderer/src/main/resources/site-renderer_de.properties:
##########
@@ -16,6 +16,7 @@
# under the License.
template.lastpublished=Zuletzt ver\u00F6ffentlicht
+template.lastmodified=Zuletzt ver\u00F6ndert
Review Comment:
Nicht "geƤndert"?
##########
doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java:
##########
@@ -589,6 +660,23 @@ protected Context createDocumentVelocityContext(
context.put("alignedFilePath", alignedFilePath);
// TODO Deprecated -- will be removed!
context.put("alignedFileName", alignedFilePath);
+
+ if (docRenderingContext.getScmInfo() != null) {
+ if (docRenderingContext.getScmInfo().getLastChangedDateTime() != null) {
+ // Velocity can only deal with Date/Calendar
+ Date scmModifiedDate = Date.from(docRenderingContext
+ .getScmInfo()
+ .getLastChangedDateTime()
+ .toInstant());
+ context.put("scmModifiedDate", scmModifiedDate);
+ } else {
+ LOGGER.warn(
Review Comment:
Why does this require WARN level?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SCM last modification date from Markup source in Velocity [maven-doxia-sitetools]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #624:
URL: https://github.com/apache/maven-doxia-sitetools/pull/624#discussion_r2935068117
##########
doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java:
##########
@@ -334,8 +353,11 @@ void velocityToolManager() throws Exception {
siteRenderingContext.setTemplateProperties(attributes);
siteRenderingContext.setTemplateName("org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm");
- DocumentRenderingContext docRenderingContext =
- new DocumentRenderingContext(new File(""), "document.html", "generator");
+
+ InfoItem infoItem = Mockito.mock(InfoItem.class);
+ Mockito.when(infoItem.getLastChangedDateTime()).thenReturn(OffsetDateTime.parse("2024-06-01T12:00:00Z"));
Review Comment:
We had a discussion back then but this is SCM API that prescribes the type!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org