449001 - Remove start.d directory from JETTY_HOME

+ Removed start.d from {jetty.home}
+ Removed most of start.ini content as well
+ DID NOT remove or alter start.d functionality from start.jar
+ DID NOT remove or alter demo-base/start.d/ example
+ Made running jetty from {jetty.home} simply show a warning message
+ DID NOT remove ability to run jetty from {jetty.home}
  Just made it a manual process requiring intention on behalf of the
  user
This commit is contained in:
Joakim Erdfelt 2014-10-28 09:04:25 -07:00
parent 264e0bce39
commit 9dd0db8eeb
6 changed files with 81 additions and 62 deletions

View File

@ -558,22 +558,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>setup home</id>
<phase>process-classes</phase>
<configuration>
<mainClass>org.eclipse.jetty.start.Main</mainClass>
<arguments>
<argument>jetty.home=${assembly-directory}</argument>
<argument>jetty.base=${assembly-directory}</argument>
<argument>--add-to-start=server,deploy,websocket,ext,resources</argument>
<argument>--add-to-startd=jsp,jstl,http</argument>
</arguments>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
<execution>
<id>setup demo-base</id>
<phase>process-classes</phase>

View File

@ -1,35 +1,16 @@
#===========================================================
# Jetty start.jar arguments
# Jetty Home Start INI
#
# The contents of this file, together with the *.ini
# files found in start.d directory are used to build
# the classpath and command line on a call to
# java -jar start.jar [arg...]
#
# Use the following command to see more options
# java -jar start.jar --help
#
# Each line in these files is prepended to the command line
# as arguments and may be either:
# + A property like: name=value
# + A module to enable like: --module=jmx
# + An XML configuration file like: etc/jetty-feature.xml
# + A start.jar option like: --dry-run
#
# If --exec or --dry-run are used, then this file may also
# contain lines with:
# + A JVM option like: -Xmx2000m
# + A System Property like: -Dcom.sun.management.jmxremote
#
# The --add-to-start=module option can be used to append
# a configuration template for a module to start.ini
# The --add-to-startd=module option can be used to create
# a configuration template for a module in start.d/module.ini
# For example configure and run with SPDY use
#
# java -jar start.jar --add-to-startd=spdy
# $EDITOR start.d/spdy.ini
# java -jar start.jar
# It is not recommended to run Jetty from {jetty.home}
#
# This configuration simply presents a warning message
# about this recommendation.
#
# It is considered an advanced features to run Jetty
# from {jetty.home}. If you are brave enough to do this
# then start with a fresh {jetty.home}/start.ini
#===========================================================
# Show warning message
-Dmain.class=org.eclipse.jetty.start.BaseHomeWarning

View File

@ -0,0 +1,34 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.start;
public class BaseHomeWarning
{
public static void main(String[] args)
{
if(!Main.printTextResource("org/eclipse/jetty/start/base-home-warning.txt"))
{
StartLog.warn("It is not recommended to run Jetty from within {jetty.home}");
StartLog.warn("Use proper {jetty.base} setup");
StartLog.warn("See: http://www.eclipse.org/jetty/documentation/current/startup.html");
}
System.exit(-1);
}
}

View File

@ -880,15 +880,26 @@ public class Main
public void usage(boolean exit)
{
StartLog.endStartLog();
String usageResource = "org/eclipse/jetty/start/usage.txt";
boolean usagePresented = false;
try (InputStream usageStream = getClass().getClassLoader().getResourceAsStream(usageResource))
if(!printTextResource("org/eclipse/jetty/start/usage.txt"))
{
if (usageStream != null)
System.err.println("ERROR: detailed usage resource unavailable");
}
if (exit)
{
System.exit(EXIT_USAGE);
}
}
public static boolean printTextResource(String resourceName)
{
boolean resourcePrinted = false;
try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName))
{
if (stream != null)
{
try (InputStreamReader reader = new InputStreamReader(usageStream); BufferedReader buf = new BufferedReader(reader))
try (InputStreamReader reader = new InputStreamReader(stream); BufferedReader buf = new BufferedReader(reader))
{
usagePresented = true;
resourcePrinted = true;
String line;
while ((line = buf.readLine()) != null)
{
@ -898,21 +909,15 @@ public class Main
}
else
{
System.out.println("No usage.txt ??");
System.out.println("Unable to find resource: " + resourceName);
}
}
catch (IOException e)
{
StartLog.warn(e);
}
if (!usagePresented)
{
System.err.println("ERROR: detailed usage resource unavailable");
}
if (exit)
{
System.exit(EXIT_USAGE);
}
return resourcePrinted;
}
// ------------------------------------------------------------

View File

@ -573,7 +573,7 @@ public class StartArgs
for (String key : systemPropertyKeys)
{
// ignored keys
if ("jetty.home".equals(key) || "jetty.base".equals(key))
if ("jetty.home".equals(key) || "jetty.base".equals(key) || "main.class".equals(key))
{
// skip
continue;

View File

@ -0,0 +1,15 @@
WARNING
-------
While it is possible to run Jetty from within {jetty.home},
it is not recommended that you run Jetty this way.
Please setup a proper {jetty.base}.
See http://www.eclipse.org/jetty/documentation/current/startup.html
The demo-base has been provided to you for an example of this kind of setup.
$ cd demo-base
$ java -jar ../start.jar