mirror of https://github.com/apache/archiva.git
display build timestamp and build number in system status page
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177721 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c7bd423375
commit
ab8e566d28
|
@ -897,5 +897,69 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>svn-buildnumber</id>
|
||||
<activation>
|
||||
<file>
|
||||
<exists>.svn</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<doCheck>false</doCheck>
|
||||
<doUpdate>false</doUpdate>
|
||||
<providerImplementations>
|
||||
<svn>javasvn</svn>
|
||||
</providerImplementations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>non-canonical-buildnumber</id>
|
||||
<activation>
|
||||
<file>
|
||||
<missing>.svn</missing>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<doCheck>false</doCheck>
|
||||
<doUpdate>false</doUpdate>
|
||||
<format>NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1}</format>
|
||||
<items>
|
||||
<item>timestamp</item>
|
||||
<item>${user.name}</item>
|
||||
</items>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -18,3 +18,5 @@
|
|||
#
|
||||
user.agent=Apache Archiva/${project.version}
|
||||
archiva.version=${project.version}
|
||||
archiva.buildNumber=${buildNumber}
|
||||
archiva.timestamp=${timestamp}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -135,6 +135,10 @@
|
|||
<h2>Current Time</h2>
|
||||
|
||||
<p><%= new Date() %></p>
|
||||
|
||||
<h2>Version Information</h2>
|
||||
|
||||
Build number: <s:property value="archivaBuildNumber"/> - Build Timestamp: <s:property value="archivaBuildTimestampDateStr"/>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -1459,6 +1459,11 @@
|
|||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello-maven-plugin</artifactId>
|
||||
|
|
Loading…
Reference in New Issue