summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2008-03-31 03:25:25 +0000
committerBrett Porter <brett@apache.org>2008-03-31 03:25:25 +0000
commita49a0f2863495845ee39a2f0f33f16325e9f3813 (patch)
tree47c3e599be5b85b8ccbf879b1bceb6e3b9fd1a86
parent03726c42138d197881eda911567103c2d670db5e (diff)
downloadarchiva-a49a0f2863495845ee39a2f0f33f16325e9f3813.tar.gz
archiva-a49a0f2863495845ee39a2f0f33f16325e9f3813.zip
fix the version handling since the group ID change, and simplify in the process
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@642863 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaVersion.java70
1 files changed, 19 insertions, 51 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaVersion.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaVersion.java
index edfc6b695..34ab2f282 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaVersion.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaVersion.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.startup;
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
@@ -47,67 +48,34 @@ public class ArchivaVersion
return version;
}
- /* This is the search order of modules to find the version.
- @todo is this really necessary? Just use webapp?
- */
- String[] modules = new String[] {
- "archiva-common",
- "archiva-configuration",
- "archiva-database",
- "archiva-consumer-api",
- "archiva-core-consumers",
- "archiva-signature-consumers",
- "archiva-database-consumers",
- "archiva-lucene-consumers",
- "archiva-indexer",
- "archiva-model",
- "archiva-policies",
- "archiva-proxy",
- "archiva-report-manager",
- "archiva-artifact-reports",
- "archiva-project-reports",
- "archiva-metadata-reports",
- "archiva-repository-layer",
- "archiva-scheduled",
- "archiva-webapp",
- "archiva-security",
- "archiva-applet",
- "archiva-xml-tools" };
-
- for ( int i = 0; i < modules.length; i++ )
+ InputStream is = cloader.getResourceAsStream( "/META-INF/maven/org.apache.archiva/archiva-configuration/pom.properties" );
+ if ( is != null )
{
- String module = modules[i];
- URL pomurl = findModulePom( cloader, module );
- if ( pomurl != null )
+ try
{
- try
- {
- Properties props = new Properties();
- InputStream is = pomurl.openStream();
- props.load( is );
- String version = props.getProperty( "version" );
- if ( StringUtils.isNotBlank( version ) )
- {
- ArchivaVersion.version = version;
- return version;
- }
- }
- catch ( IOException e )
+ Properties props = new Properties();
+ props.load( is );
+ String version = props.getProperty( "version" );
+ if ( StringUtils.isNotBlank( version ) )
{
- /* do nothing */
+ ArchivaVersion.version = version;
+ return version;
}
}
+ catch ( IOException e )
+ {
+ /* do nothing */
+ }
+ finally
+ {
+ IOUtils.closeQuietly( is );
+ }
}
- version = "<Unknown Version>";
+ ArchivaVersion.version = "";
return version;
}
- private static URL findModulePom( ClassLoader cloader, String module )
- {
- return cloader.getResource( "/META-INF/maven/org.apache.maven.archiva/" + module + "/pom.properties" );
- }
-
public static String getVersion()
{
return version;