diff --git a/jetty-jndi/src/main/config/modules/jndi.mod b/jetty-jndi/src/main/config/modules/jndi.mod
index de3087bd26f..cfdcc526142 100644
--- a/jetty-jndi/src/main/config/modules/jndi.mod
+++ b/jetty-jndi/src/main/config/modules/jndi.mod
@@ -3,10 +3,7 @@
#
DEPEND=server
-DEPEND=plus
LIB=lib/jetty-jndi-${jetty.version}.jar
LIB=lib/jndi/*.jar
-# Annotations needs annotations configuration
-etc/jetty-server.xml
diff --git a/jetty-plus/src/main/config/modules/plus.mod b/jetty-plus/src/main/config/modules/plus.mod
index 31d8e76b95c..caa799376a6 100644
--- a/jetty-plus/src/main/config/modules/plus.mod
+++ b/jetty-plus/src/main/config/modules/plus.mod
@@ -3,6 +3,8 @@
#
DEPEND=server
+DEPEND=security
+DEPEND=jndi
LIB=lib/jetty-plus-${jetty.version}.jar
diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml
index c93342fc71c..2fb71301dc5 100644
--- a/jetty-servlet/pom.xml
+++ b/jetty-servlet/pom.xml
@@ -53,6 +53,23 @@
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+ config
+
+
+
+
+
org.codehaus.mojo
findbugs-maven-plugin
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
index d72c943c741..25291aedd4c 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java
@@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Stack;
/**
* Access for all modules declared, as well as what is enabled.
@@ -59,8 +60,6 @@ public class Modules implements Iterable
*/
public void buildGraph()
{
- // TODO: Validate / Enforce Directed Acyclic Graph
-
// Connect edges
for (Module module : modules.values())
{
@@ -75,6 +74,15 @@ public class Modules implements Iterable
}
}
+ // Verify there is no cyclic references
+ Stack refs = new Stack<>();
+ for (Module module : modules.values())
+ {
+ refs.push(module.getName());
+ assertNoCycle(module,refs);
+ refs.pop();
+ }
+
// Calculate depth of all modules for sorting later
for (Module module : modules.values())
{
@@ -85,6 +93,33 @@ public class Modules implements Iterable
}
}
+ private void assertNoCycle(Module module, Stack refs)
+ {
+ for (Module parent : module.getParentEdges())
+ {
+ if (refs.contains(parent.getName()))
+ {
+ // Cycle detected.
+ StringBuilder err = new StringBuilder();
+ err.append("A cyclic reference in the modules has been detected: ");
+ for (int i = 0; i < refs.size(); i++)
+ {
+ if (i > 0)
+ {
+ err.append(" -> ");
+ }
+ err.append(refs.get(i));
+ }
+ err.append(" -> ").append(parent.getName());
+ throw new IllegalStateException(err.toString());
+ }
+
+ refs.push(parent.getName());
+ assertNoCycle(parent,refs);
+ refs.pop();
+ }
+ }
+
public Integer count()
{
return modules.size();
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java
index 83307347f14..0d6addd7ecb 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java
@@ -39,7 +39,7 @@ public class ModulesTest
Modules modules = new Modules();
modules.registerAll(basehome);
- Assert.assertThat("Module count",modules.count(),is(24));
+ Assert.assertThat("Module count",modules.count(),is(26));
}
@Test
@@ -63,6 +63,7 @@ public class ModulesTest
// Assert names are correct, and in the right order
List expectedNames = new ArrayList<>();
expectedNames.add("base");
+ expectedNames.add("xml");
expectedNames.add("server");
expectedNames.add("http");
@@ -78,6 +79,7 @@ public class ModulesTest
List expectedLibs = new ArrayList<>();
expectedLibs.add("lib/jetty-util-${jetty.version}.jar");
expectedLibs.add("lib/jetty-io-${jetty.version}.jar");
+ expectedLibs.add("lib/jetty-xml-${jetty.version}.jar");
expectedLibs.add("lib/servlet-api-3.1.jar");
expectedLibs.add("lib/jetty-schemas-3.1.jar");
expectedLibs.add("lib/jetty-http-${jetty.version}.jar");
@@ -118,8 +120,11 @@ public class ModulesTest
// Assert names are correct, and in the right order
List expectedNames = new ArrayList<>();
expectedNames.add("base");
+ expectedNames.add("xml");
expectedNames.add("server");
expectedNames.add("http");
+ expectedNames.add("jndi");
+ expectedNames.add("security");
expectedNames.add("plus");
expectedNames.add("annotations");
expectedNames.add("websocket");
@@ -136,11 +141,15 @@ public class ModulesTest
List expectedLibs = new ArrayList<>();
expectedLibs.add("lib/jetty-util-${jetty.version}.jar");
expectedLibs.add("lib/jetty-io-${jetty.version}.jar");
+ expectedLibs.add("lib/jetty-xml-${jetty.version}.jar");
expectedLibs.add("lib/servlet-api-3.1.jar");
expectedLibs.add("lib/jetty-schemas-3.1.jar");
expectedLibs.add("lib/jetty-http-${jetty.version}.jar");
expectedLibs.add("lib/jetty-continuation-${jetty.version}.jar");
expectedLibs.add("lib/jetty-server-${jetty.version}.jar");
+ expectedLibs.add("lib/jetty-jndi-${jetty.version}.jar");
+ expectedLibs.add("lib/jndi/*.jar");
+ expectedLibs.add("lib/jetty-security-${jetty.version}.jar");
expectedLibs.add("lib/jetty-plus-${jetty.version}.jar");
expectedLibs.add("lib/jetty-annotations-${jetty.version}.jar");
expectedLibs.add("lib/annotations/*.jar");
diff --git a/jetty-start/src/test/resources/assert-home-with-jvm.txt b/jetty-start/src/test/resources/assert-home-with-jvm.txt
index 18337a5d691..03d38cea2d1 100644
--- a/jetty-start/src/test/resources/assert-home-with-jvm.txt
+++ b/jetty-start/src/test/resources/assert-home-with-jvm.txt
@@ -8,18 +8,23 @@ XML|${jetty.home}/etc/jetty-websockets.xml
XML|${jetty.home}/etc/jetty-logging.xml
# The LIBs we expect (order is irrelevant)
-LIB|${jetty.home}/lib/jetty-http-TEST.jar
-LIB|${jetty.home}/lib/jetty-util-TEST.jar
-LIB|${jetty.home}/lib/jetty-schemas-3.1.jar
-LIB|${jetty.home}/lib/jetty-jmx-TEST.jar
LIB|${jetty.home}/lib/annotations/javax.annotation-api-1.2.jar
-LIB|${jetty.home}/lib/servlet-api-3.1.jar
-LIB|${jetty.home}/lib/jetty-annotations-TEST.jar
-LIB|${jetty.home}/lib/jetty-plus-TEST.jar
-LIB|${jetty.home}/lib/jetty-io-TEST.jar
-LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
LIB|${jetty.home}/lib/annotations/org.objectweb.asm-TEST.jar
+LIB|${jetty.home}/lib/jetty-annotations-TEST.jar
+LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
+LIB|${jetty.home}/lib/jetty-http-TEST.jar
+LIB|${jetty.home}/lib/jetty-io-TEST.jar
+LIB|${jetty.home}/lib/jetty-jmx-TEST.jar
+LIB|${jetty.home}/lib/jetty-jndi-TEST.jar
+LIB|${jetty.home}/lib/jetty-plus-TEST.jar
+LIB|${jetty.home}/lib/jetty-schemas-3.1.jar
+LIB|${jetty.home}/lib/jetty-security-TEST.jar
LIB|${jetty.home}/lib/jetty-server-TEST.jar
+LIB|${jetty.home}/lib/jetty-util-TEST.jar
+LIB|${jetty.home}/lib/jetty-xml-TEST.jar
+LIB|${jetty.home}/lib/jndi/javax.activation-1.1.jar
+LIB|${jetty.home}/lib/jndi/javax.transaction-api-1.2.jar
+LIB|${jetty.home}/lib/servlet-api-3.1.jar
# The Properties we expect (order is irrelevant)
# PROP|jetty.port=9090
diff --git a/jetty-start/src/test/resources/assert-home.txt b/jetty-start/src/test/resources/assert-home.txt
index a0c1a8eaf37..1349723c154 100644
--- a/jetty-start/src/test/resources/assert-home.txt
+++ b/jetty-start/src/test/resources/assert-home.txt
@@ -7,18 +7,23 @@ XML|${jetty.home}/etc/jetty-annotations.xml
XML|${jetty.home}/etc/jetty-websockets.xml
# The LIBs we expect (order is irrelevant)
-LIB|${jetty.home}/lib/jetty-http-TEST.jar
-LIB|${jetty.home}/lib/jetty-util-TEST.jar
-LIB|${jetty.home}/lib/jetty-schemas-3.1.jar
-LIB|${jetty.home}/lib/jetty-jmx-TEST.jar
LIB|${jetty.home}/lib/annotations/javax.annotation-api-1.2.jar
-LIB|${jetty.home}/lib/servlet-api-3.1.jar
-LIB|${jetty.home}/lib/jetty-annotations-TEST.jar
-LIB|${jetty.home}/lib/jetty-plus-TEST.jar
-LIB|${jetty.home}/lib/jetty-io-TEST.jar
-LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
LIB|${jetty.home}/lib/annotations/org.objectweb.asm-TEST.jar
+LIB|${jetty.home}/lib/jetty-annotations-TEST.jar
+LIB|${jetty.home}/lib/jetty-continuation-TEST.jar
+LIB|${jetty.home}/lib/jetty-http-TEST.jar
+LIB|${jetty.home}/lib/jetty-io-TEST.jar
+LIB|${jetty.home}/lib/jetty-jmx-TEST.jar
+LIB|${jetty.home}/lib/jetty-jndi-TEST.jar
+LIB|${jetty.home}/lib/jetty-plus-TEST.jar
+LIB|${jetty.home}/lib/jetty-schemas-3.1.jar
+LIB|${jetty.home}/lib/jetty-security-TEST.jar
LIB|${jetty.home}/lib/jetty-server-TEST.jar
+LIB|${jetty.home}/lib/jetty-util-TEST.jar
+LIB|${jetty.home}/lib/jetty-xml-TEST.jar
+LIB|${jetty.home}/lib/jndi/javax.activation-1.1.jar
+LIB|${jetty.home}/lib/jndi/javax.transaction-api-1.2.jar
+LIB|${jetty.home}/lib/servlet-api-3.1.jar
# The Properties we expect (order is irrelevant)
PROP|jetty.port=9090
diff --git a/jetty-start/src/test/resources/usecases/home/modules/jndi.mod b/jetty-start/src/test/resources/usecases/home/modules/jndi.mod
index de3087bd26f..cfdcc526142 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/jndi.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/jndi.mod
@@ -3,10 +3,7 @@
#
DEPEND=server
-DEPEND=plus
LIB=lib/jetty-jndi-${jetty.version}.jar
LIB=lib/jndi/*.jar
-# Annotations needs annotations configuration
-etc/jetty-server.xml
diff --git a/jetty-start/src/test/resources/usecases/home/modules/plus.mod b/jetty-start/src/test/resources/usecases/home/modules/plus.mod
index 31d8e76b95c..caa799376a6 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/plus.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/plus.mod
@@ -3,6 +3,8 @@
#
DEPEND=server
+DEPEND=security
+DEPEND=jndi
LIB=lib/jetty-plus-${jetty.version}.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/proxy.mod b/jetty-start/src/test/resources/usecases/home/modules/proxy.mod
index 9e2bc46db8c..5ab6e70a880 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/proxy.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/proxy.mod
@@ -3,6 +3,7 @@
#
DEPEND=server
+DEPEND=client
LIB=lib/jetty-proxy-${jetty.version}.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/security.mod b/jetty-start/src/test/resources/usecases/home/modules/security.mod
new file mode 100644
index 00000000000..5a3c4a368a6
--- /dev/null
+++ b/jetty-start/src/test/resources/usecases/home/modules/security.mod
@@ -0,0 +1,7 @@
+#
+# Jetty Security Module
+#
+
+DEPEND=server
+
+LIB=lib/jetty-security-${jetty.version}.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/server.mod b/jetty-start/src/test/resources/usecases/home/modules/server.mod
index 06bf6772f5b..aa6cad6b0e6 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/server.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/server.mod
@@ -3,6 +3,7 @@
#
DEPEND=base
+DEPEND=xml
LIB=lib/servlet-api-3.1.jar
LIB=lib/jetty-schemas-3.1.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/servlet.mod b/jetty-start/src/test/resources/usecases/home/modules/servlet.mod
new file mode 100644
index 00000000000..a427eed5478
--- /dev/null
+++ b/jetty-start/src/test/resources/usecases/home/modules/servlet.mod
@@ -0,0 +1,7 @@
+#
+# Jetty Servlet Module
+#
+
+DEPEND=server
+
+LIB=lib/jetty-servlet-${jetty.version}.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/spdy.mod b/jetty-start/src/test/resources/usecases/home/modules/spdy.mod
index 4a70136f556..1f3d5e99614 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/spdy.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/spdy.mod
@@ -1,5 +1,7 @@
DEPEND=server
+LIB=lib/spdy/*.jar
+
etc/jetty-ssl.xml
etc/jetty-spdy.xml
diff --git a/jetty-start/src/test/resources/usecases/home/modules/webapp.mod b/jetty-start/src/test/resources/usecases/home/modules/webapp.mod
index 187db774b69..c39d5aae063 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/webapp.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/webapp.mod
@@ -2,6 +2,6 @@
# Base server
#
-DEPEND=deploy
+DEPEND=servlet
LIB=lib/jetty-webapp-${jetty.version}.jar
diff --git a/jetty-start/src/test/resources/usecases/home/modules/websocket.mod b/jetty-start/src/test/resources/usecases/home/modules/websocket.mod
index b8571fb12aa..e61ec33e184 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/websocket.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/websocket.mod
@@ -11,3 +11,4 @@ LIB=lib/websockets/*.jar
# WebSocket needs websocket configuration
etc/jetty-websockets.xml
+