Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-04-15 17:32:28 +0000
committerJoakim Erdfelt2014-04-15 17:32:28 +0000
commit41ab91988b7770aea374556e08e20bb2ec984135 (patch)
tree487ef7744e083bb1352c4e9c5f3c343af0389eaf /jetty-start
parent599595f54484208b069e85ec188a4c57e7067167 (diff)
downloadorg.eclipse.jetty.project-41ab91988b7770aea374556e08e20bb2ec984135.tar.gz
org.eclipse.jetty.project-41ab91988b7770aea374556e08e20bb2ec984135.tar.xz
org.eclipse.jetty.project-41ab91988b7770aea374556e08e20bb2ec984135.zip
432321 - jetty-start / Allow defining extra start directories for common configurations
+ Fixing jetty.base default detection to use user.dir instead of jetty.home
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java4
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java3
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java9
3 files changed, 10 insertions, 6 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java b/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java
index df6db187c1..61f9f643f1 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/config/CommandLineConfigSource.java
@@ -81,8 +81,8 @@ public class CommandLineConfigSource implements ConfigSource
return FS.toPath(val);
}
- // Lastly, fall back to base == home
- Path base = this.homePath.toAbsolutePath();
+ // Lastly, fall back to base == ${user.dir}
+ Path base = FS.toPath(this.props.getString("user.dir","."));
setProperty(BaseHome.JETTY_BASE,base.toString(),ORIGIN_INTERNAL_FALLBACK);
return base;
}
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
index dcd9baf221..36c11743cb 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
@@ -100,7 +100,8 @@ public class ConfigurationAssert
for (Prop prop : args.getProperties())
{
String name = prop.key;
- if ("jetty.home".equals(name) || "jetty.base".equals(name) || prop.origin.equals(Props.ORIGIN_SYSPROP))
+ if ("jetty.home".equals(name) || "jetty.base".equals(name) ||
+ "user.dir".equals(name) || prop.origin.equals(Props.ORIGIN_SYSPROP))
{
// strip these out from assertion, to make assertions easier.
continue;
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
index 561a013dfa..a8003c3bdf 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java
@@ -43,7 +43,8 @@ public class MainTest
public void testBasicProcessing() throws Exception
{
List<String> cmdLineArgs = new ArrayList<>();
- File testJettyHome = MavenTestingUtils.getTestResourceDir("usecases/home");
+ File testJettyHome = MavenTestingUtils.getTestResourceDir("usecases/home").getAbsoluteFile();
+ cmdLineArgs.add("user.dir=" + testJettyHome);
cmdLineArgs.add("jetty.home=" + testJettyHome);
cmdLineArgs.add("jetty.port=9090");
@@ -103,8 +104,9 @@ public class MainTest
{
List<String> cmdLineArgs = new ArrayList<>();
- File homePath = MavenTestingUtils.getTestResourceDir("usecases/home");
+ File homePath = MavenTestingUtils.getTestResourceDir("usecases/home").getAbsoluteFile();
cmdLineArgs.add("jetty.home=" + homePath);
+ cmdLineArgs.add("user.dir=" + homePath);
// JVM args
cmdLineArgs.add("--exec");
@@ -137,7 +139,8 @@ public class MainTest
{
List<String> cmdLineArgs = new ArrayList<>();
- File homePath = MavenTestingUtils.getTestResourceDir("jetty home with spaces");
+ File homePath = MavenTestingUtils.getTestResourceDir("jetty home with spaces").getAbsoluteFile();
+ cmdLineArgs.add("user.dir=" + homePath);
cmdLineArgs.add("jetty.home=" + homePath);
Main main = new Main();

Back to the top