Permalink
Browse files

[NXCM-5196] Read version from "/META-INF/nexus/nexus-bundle.propertie…

…s" if file is available (only in bundles build by nexus-bundles project). Otherwise, fallback to maven pom.properties (as before)

Signed-off-by: Alin Dreghiciu <adreghiciu@gmail.com>
  • Loading branch information...
1 parent 03f7bd8 commit ed2e76ac53a3b812bac152900bd00c76bc89a5ac @adreghiciu adreghiciu committed Apr 8, 2013
@@ -116,7 +116,19 @@ public boolean setState( SystemState state )
*/
protected String readVersion( String path )
{
- String version = "Unknown";
+ final String version = readVersionIfPresent( path );
+ return version == null ? "Unknown" : version;
+ }
+
+ /**
+ * Reads the version from a properties file (the one embedded by Maven into Jar) returning null if version could
+ * not be determined.
+ *
+ * @since 2.5.0
+ */
+ protected String readVersionIfPresent( String path )
+ {
+ String version = null;
try
{
@@ -50,6 +50,11 @@ protected void renewSystemStatus( SystemStatus systemStatus )
@Override
protected String discoverApplicationVersion()
{
- return readVersion( "/META-INF/maven/org.sonatype.nexus/nexus-oss-edition/pom.properties" );
+ String version = readVersionIfPresent( "/META-INF/nexus/nexus-bundle.properties" );
+ if ( version == null )
+ {
+ version = readVersion( "/META-INF/maven/org.sonatype.nexus/nexus-oss-edition/pom.properties" );
+ }
+ return version;
}
}

0 comments on commit ed2e76a

Please sign in to comment.