Issue #6148 - update jetty.tag.version behavior
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
aed20abcbe
commit
871560032e
|
@ -13,7 +13,30 @@
|
||||||
<spotbugs.onlyAnalyze>org.eclipse.jetty.start.*</spotbugs.onlyAnalyze>
|
<spotbugs.onlyAnalyze>org.eclipse.jetty.start.*</spotbugs.onlyAnalyze>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>create-buildnumber</id>
|
||||||
|
<goals>
|
||||||
|
<goal>create</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<doCheck>false</doCheck>
|
||||||
|
<doUpdate>false</doUpdate>
|
||||||
|
<revisionOnScmFailure>${nonCanonicalRevision}</revisionOnScmFailure>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
package org.eclipse.jetty.start;
|
package org.eclipse.jetty.start;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -365,4 +367,25 @@ public final class Props implements Iterable<Prop>
|
||||||
{
|
{
|
||||||
return props.toString();
|
return props.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Props load(URL url)
|
||||||
|
{
|
||||||
|
Props props = new Props();
|
||||||
|
if (url != null)
|
||||||
|
{
|
||||||
|
try (InputStream in = url.openStream())
|
||||||
|
{
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.load(in);
|
||||||
|
String urlStr = url.toExternalForm();
|
||||||
|
properties.stringPropertyNames().forEach((name) ->
|
||||||
|
props.setProperty(name, properties.getProperty(name), urlStr));
|
||||||
|
}
|
||||||
|
catch (IOException x)
|
||||||
|
{
|
||||||
|
StartLog.debug(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,7 @@ package org.eclipse.jetty.start;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -69,8 +67,8 @@ public class StartArgs
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
// Use command line versions
|
// Use command line versions
|
||||||
String ver = System.getProperty("jetty.version", null);
|
String ver = System.getProperty("jetty.version");
|
||||||
String tag = System.getProperty("jetty.tag.version", "master");
|
String tag = System.getProperty("jetty.tag.version");
|
||||||
|
|
||||||
// Use META-INF/MANIFEST.MF versions
|
// Use META-INF/MANIFEST.MF versions
|
||||||
if (ver == null)
|
if (ver == null)
|
||||||
|
@ -82,41 +80,21 @@ public class StartArgs
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use jetty-version.properties values
|
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||||
if (ver == null)
|
// use old jetty-version.properties (as seen within various linux distro repackaging of Jetty)
|
||||||
|
Props jettyVerProps = Props.load(classLoader.getResource("jetty-version.properties"));
|
||||||
|
// use build-time properties (included in start.jar) to pull version and buildNumber
|
||||||
|
Props buildProps = Props.load(classLoader.getResource("/org/eclipse/jetty/version/build.properties"));
|
||||||
|
|
||||||
|
if (Utils.isBlank(ver))
|
||||||
{
|
{
|
||||||
URL url = Thread.currentThread().getContextClassLoader().getResource("jetty-version.properties");
|
ver = jettyVerProps.getString("version", buildProps.getString("version", "0.0"));
|
||||||
if (url != null)
|
|
||||||
{
|
|
||||||
try (InputStream in = url.openStream())
|
|
||||||
{
|
|
||||||
Properties props = new Properties();
|
|
||||||
props.load(in);
|
|
||||||
ver = props.getProperty("jetty.version");
|
|
||||||
}
|
|
||||||
catch (IOException x)
|
|
||||||
{
|
|
||||||
StartLog.debug(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default values
|
if (Utils.isBlank(tag))
|
||||||
if (ver == null)
|
|
||||||
{
|
{
|
||||||
ver = "0.0";
|
tag = jettyVerProps.getString("buildNumber", buildProps.getString("buildNumber", "jetty-" + ver));
|
||||||
if (tag == null)
|
|
||||||
tag = "master";
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (tag == null)
|
|
||||||
tag = "jetty-" + ver;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Tag Defaults
|
|
||||||
if (tag.contains("-SNAPSHOT"))
|
|
||||||
tag = "master";
|
|
||||||
|
|
||||||
VERSION = ver;
|
VERSION = ver;
|
||||||
System.setProperty("jetty.version", VERSION);
|
System.setProperty("jetty.version", VERSION);
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
buildNumber=${buildNumber}
|
||||||
|
timestamp=${timestamp}
|
||||||
|
version=${project.version}
|
||||||
|
scmUrl=${project.scm.connection}
|
Loading…
Reference in New Issue