[MRM-559] fix version setting

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@587079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2007-10-22 13:02:47 +00:00
parent 19afbc4ac8
commit 7ada562597
2 changed files with 21 additions and 12 deletions

View File

@ -34,18 +34,22 @@ import java.util.Properties;
*/
public class ArchivaVersion
{
public static String VERSION = "Unknown";
private static String version = null;
private ArchivaVersion()
{
}
public static String determineVersion( ClassLoader cloader )
{
if ( VERSION != null )
if ( version != null )
{
return VERSION;
return version;
}
/* This is the search order of modules to find the version.
*/
String modules[] = new String[] {
String[] modules = new String[] {
"archiva-common",
"archiva-configuration",
"archiva-database",
@ -83,8 +87,8 @@ public class ArchivaVersion
String version = props.getProperty( "version" );
if ( StringUtils.isNotBlank( version ) )
{
VERSION = version;
return VERSION;
ArchivaVersion.version = version;
return this.version;
}
}
catch ( IOException e )
@ -94,12 +98,17 @@ public class ArchivaVersion
}
}
return VERSION;
version = "<Unknown Version>";
return version;
}
private static URL findModulePom( ClassLoader cloader, String module )
{
URL ret = cloader.getResource( "/META-INF/maven/org.apache.maven.archiva/" + module + "/pom.properties" );
return ret;
return cloader.getResource( "/META-INF/maven/org.apache.maven.archiva/" + module + "/pom.properties" );
}
public static String getVersion()
{
return version;
}
}

View File

@ -24,8 +24,8 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="org.apache.maven.archiva.web.startup.ArchivaVersion" %>
<%@ page import="java.util.Calendar" %>
<html>
<head>
@ -176,7 +176,7 @@
%>
<div id="footer">
<div class="xleft">
Apache Archiva <%= ArchivaVersion.VERSION %>
Apache Archiva <%= ArchivaVersion.getVersion() %>
</div>
<div class="xright">
Copyright &#169; <%= copyrightRange %> Apache Software Foundation