[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 class ArchivaVersion
{ {
public static String VERSION = "Unknown"; private static String version = null;
private ArchivaVersion()
{
}
public static String determineVersion( ClassLoader cloader ) 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. /* This is the search order of modules to find the version.
*/ */
String modules[] = new String[] { String[] modules = new String[] {
"archiva-common", "archiva-common",
"archiva-configuration", "archiva-configuration",
"archiva-database", "archiva-database",
@ -83,8 +87,8 @@ public class ArchivaVersion
String version = props.getProperty( "version" ); String version = props.getProperty( "version" );
if ( StringUtils.isNotBlank( version ) ) if ( StringUtils.isNotBlank( version ) )
{ {
VERSION = version; ArchivaVersion.version = version;
return VERSION; return this.version;
} }
} }
catch ( IOException e ) 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 ) private static URL findModulePom( ClassLoader cloader, String module )
{ {
URL ret = cloader.getResource( "/META-INF/maven/org.apache.maven.archiva/" + module + "/pom.properties" ); return cloader.getResource( "/META-INF/maven/org.apache.maven.archiva/" + module + "/pom.properties" );
return ret; }
public static String getVersion()
{
return version;
} }
} }

View File

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