449001 - Remove start.d directory from JETTY_HOME

+ Reworking warning to be optional but still start Jetty also.
+ Leaving start.d out of {jetty.home} still.
This commit is contained in:
Joakim Erdfelt 2014-10-28 10:28:17 -07:00
parent f4f600ff05
commit af5f9382a4
6 changed files with 77 additions and 26 deletions

View File

@ -558,6 +558,21 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<executions> <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,jsp,jstl,http</argument>
</arguments>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
<execution> <execution>
<id>setup demo-base</id> <id>setup demo-base</id>
<phase>process-classes</phase> <phase>process-classes</phase>

View File

@ -1,16 +1,23 @@
#=========================================================== #===========================================================
# Jetty Home Start INI # NOTE: Jetty is starting using LEGACY behavior
# #
# It is not recommended to run Jetty from {jetty.home} # Starting Jetty from this {jetty.home} is LEGACY behavior.
# #
# This configuration simply presents a warning message # A proper {jetty.base} should be configured with no changes
# about this recommendation. # being made to this {jetty.home}.
#
# http://www.eclipse.org/jetty/documentation/current/startup.html
#
# A demo-base directory has been provided as an example of
# this setup.
#
# $ cd demo-base
# $ java -jar ../start.jar
#
# This {jetty.home}/start.ini has been provided to duplicate
# historical default jetty-distribution settings.
# #
# 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 # To disable the warning message, uncomment the following line
-Dmain.class=org.eclipse.jetty.start.BaseHomeWarning # -Dorg.eclipse.jetty.start.home.warning=false

View File

@ -18,17 +18,34 @@
package org.eclipse.jetty.start; package org.eclipse.jetty.start;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.start.Props.Prop;
public class BaseHomeWarning public class BaseHomeWarning
{ {
public static void main(String[] args) public static void show(Props props)
{ {
if(!Main.printTextResource("org/eclipse/jetty/start/base-home-warning.txt")) Prop showWarn = props.getProp("org.eclipse.jetty.start.home.warning",true);
if (showWarn == null || Boolean.parseBoolean(showWarn.value))
{ {
StartLog.warn("It is not recommended to run Jetty from within {jetty.home}"); if (!Main.printTextResource("org/eclipse/jetty/start/base-home-warning.txt"))
StartLog.warn("Use proper {jetty.base} setup"); {
StartLog.warn("See: http://www.eclipse.org/jetty/documentation/current/startup.html"); StartLog.warn("It is not recommended to run Jetty from within {jetty.home}");
StartLog.warn("Use a proper {jetty.base} setup");
StartLog.warn("See: http://www.eclipse.org/jetty/documentation/current/startup.html");
}
try
{
System.err.print("Your startup will proceed shortly ...");
TimeUnit.SECONDS.sleep(2);
System.err.println();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
} }
System.exit(-1);
} }
} }

View File

@ -779,6 +779,12 @@ public class Main
{ {
return; return;
} }
// Warning Message
if (!baseHome.isBaseDifferent() && args.isNormalMainClass())
{
BaseHomeWarning.show(args.getProperties());
}
// execute Jetty in another JVM // execute Jetty in another JVM
if (args.isExec()) if (args.isExec())

View File

@ -603,6 +603,11 @@ public class StartArgs
{ {
return exec; return exec;
} }
public boolean isNormalMainClass()
{
return SERVER_MAIN.equals(getMainClassname());
}
public boolean isHelp() public boolean isHelp()
{ {

View File

@ -1,15 +1,16 @@
WARNING ============================================================================
------- WARNING: Jetty is starting using LEGACY behavior.
While it is possible to run Jetty from within {jetty.home}, A proper {jetty.base} should be configured with no changes being made to the {jetty.home} directory.
it is not recommended that you run Jetty this way.
Please setup a proper {jetty.base}. Please see http://www.eclipse.org/jetty/documentation/current/startup.html
See http://www.eclipse.org/jetty/documentation/current/startup.html A demo-base directory has been provided as an example of this setup.
The demo-base has been provided to you for an example of this kind of setup. $ cd demo-base
$ java -jar ../start.jar
$ cd demo-base This warning may be disabled by setting the system property
$ java -jar ../start.jar
-Dorg.eclipse.jetty.start.home.warning=false
============================================================================