diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index a1df24399..b95df32eb 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -897,5 +897,69 @@ + + svn-buildnumber + + + .svn + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + + + generate-resources + + create + + + + + false + false + + javasvn + + + + + + + + non-canonical-buildnumber + + + .svn + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + + + generate-resources + + create + + + + + false + false + NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1} + + timestamp + ${user.name} + + + + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-webapp/src/main/filtered-resources/application.properties index 0f38c6dcc..12806aa73 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/filtered-resources/application.properties +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/filtered-resources/application.properties @@ -18,3 +18,5 @@ # user.agent=Apache Archiva/${project.version} archiva.version=${project.version} +archiva.buildNumber=${buildNumber} +archiva.timestamp=${timestamp} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java index 496b040c7..e8459591b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java @@ -28,6 +28,7 @@ import org.apache.archiva.audit.Auditable; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.security.ArchivaXworkUser; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.SessionAware; import org.codehaus.plexus.redback.users.User; @@ -39,6 +40,7 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -71,7 +73,7 @@ public abstract class AbstractActionSupport private String principal; @Inject - @Named(value = "archivaRuntimeProperties") + @Named( value = "archivaRuntimeProperties" ) private Properties archivaRuntimeProperties; @PostConstruct @@ -195,8 +197,26 @@ public abstract class AbstractActionSupport return (String) archivaRuntimeProperties.get( "archiva.version" ); } + public String getArchivaBuildNumber() + { + return (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); + } + + public String getArchivaBuildTimestamp() + { + return (String) archivaRuntimeProperties.get( "archiva.timestamp" ); + } + + public String getArchivaBuildTimestampDateStr() + { + SimpleDateFormat sfd = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssz", getLocale() ); + return sfd.format( + new Date( NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) ) ) ); + } + /** * dummy information for audit events + * * @since 1.4 */ private static class SimpleUser diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/systemStatus.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/systemStatus.jsp index 0ac99e2df..703af95ac 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/systemStatus.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/systemStatus.jsp @@ -135,6 +135,10 @@

Current Time

<%= new Date() %>

+ +

Version Information

+ + Build number: - Build Timestamp: diff --git a/pom.xml b/pom.xml index 0f18f5086..b6d77bdb4 100644 --- a/pom.xml +++ b/pom.xml @@ -1459,6 +1459,11 @@ exec-maven-plugin 1.2 + + org.codehaus.mojo + buildnumber-maven-plugin + 1.0 + org.codehaus.modello modello-maven-plugin