start.jar uses shaded jetty-util classes
diff --git a/jetty-start/dependency-reduced-pom.xml b/jetty-start/dependency-reduced-pom.xml
new file mode 100644
index 0000000..e826dad
--- /dev/null
+++ b/jetty-start/dependency-reduced-pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>jetty-project</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <version>9.3.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jetty-start</artifactId>
+ <name>Jetty :: Start</name>
+ <description>The start utility</description>
+ <url>http://www.eclipse.org/jetty</url>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.eclipse.jetty.start.Main</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <onlyAnalyze>org.eclipse.jetty.start.*</onlyAnalyze>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <minimizeJar>true</minimizeJar>
+ <artifactSet>
+ <includes>
+ <include>org.eclipse.jetty:jetty-util</include>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>org.eclipse.jetty.util</pattern>
+ <shadedPattern>org.eclipse.jetty.start.util</shadedPattern>
+ </relocation>
+ </relocations>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty.toolchain</groupId>
+ <artifactId>jetty-test-helper</artifactId>
+ <version>2.9</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>junit</artifactId>
+ <groupId>junit</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>hamcrest-library</artifactId>
+ <groupId>org.hamcrest</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <properties>
+ <bundle-symbolic-name>${project.groupId}.start</bundle-symbolic-name>
+ <start-jar-file-name>start.jar</start-jar-file-name>
+ </properties>
+</project>
+
diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml
index d70800f..b406b04 100644
--- a/jetty-start/pom.xml
+++ b/jetty-start/pom.xml
@@ -32,10 +32,42 @@
<onlyAnalyze>org.eclipse.jetty.start.*</onlyAnalyze>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <minimizeJar>true</minimizeJar>
+ <artifactSet>
+ <includes>
+ <include>org.eclipse.jetty:jetty-util</include>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>org.eclipse.jetty.util</pattern>
+ <shadedPattern>org.eclipse.jetty.start.util</shadedPattern>
+ </relocation>
+ </relocations>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
<dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
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 14c372d..98b38bd 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
@@ -33,7 +33,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.eclipse.jetty.start.util.TopologicalSort;
+import org.eclipse.jetty.util.TopologicalSort;
/**
* Access for all modules declared, as well as what is enabled.
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/util/TopologicalSort.java b/jetty-start/src/main/java/org/eclipse/jetty/start/util/TopologicalSort.java
deleted file mode 100644
index 0c2d8b4..0000000
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/util/TopologicalSort.java
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2015 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.util;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-
-
-/**
- * Topological Sort a list or array.
- * <p>A Topological sort is used when you have a partial ordering expressed as
- * dependencies between elements (also often represented as edges in a directed
- * acyclic graph). A Topological sort should not be used when you have a total
- * ordering expressed as a {@link Comparator} over the items. The algorithm has
- * the additional characteristic that dependency sets are sorted by the original
- * list order so that order is preserved when possible.</p>
- * <p>
- * The sort algorithm works by recursively visiting every item, once and
- * only once. On each visit, the items dependencies are first visited and then the
- * item is added to the sorted list. Thus the algorithm ensures that dependency
- * items are always added before dependent items.</p>
- * <p>
- * THIS CLASS IS COPIED FROM org.eclipse.jetty.util.TopologicalSort
- * @param <T> The type to be sorted. It must be able to be added to a {@link HashSet}
- */
-public class TopologicalSort<T>
-{
- private final Map<T,Set<T>> _dependencies = new HashMap<>();
-
- /**
- * Add a dependency to be considered in the sort.
- * @param dependent The dependent item will be sorted after all its dependencies
- * @param dependency The dependency item, will be sorted before its dependent item
- */
- public void addDependency(T dependent, T dependency)
- {
- Set<T> set = _dependencies.get(dependent);
- if (set==null)
- {
- set=new HashSet<>();
- _dependencies.put(dependent,set);
- }
- set.add(dependency);
- }
-
- /** Sort the passed array according to dependencies previously set with
- * {@link #addDependency(Object, Object)}. Where possible, ordering will be
- * preserved if no dependency
- * @param array The array to be sorted.
- */
- public void sort(T[] array)
- {
- List<T> sorted = new ArrayList<>();
- Set<T> visited = new HashSet<>();
- Comparator<T> comparator = new InitialOrderComparitor<>(array);
-
- // Visit all items in the array
- for (T t : array)
- visit(t,visited,sorted,comparator);
-
- sorted.toArray(array);
- }
-
- /** Sort the passed list according to dependencies previously set with
- * {@link #addDependency(Object, Object)}. Where possible, ordering will be
- * preserved if no dependency
- * @param list The list to be sorted.
- */
- public void sort(Collection<T> list)
- {
- List<T> sorted = new ArrayList<>();
- Set<T> visited = new HashSet<>();
- Comparator<T> comparator = new InitialOrderComparitor<>(list);
-
- // Visit all items in the list
- for (T t : list)
- visit(t,visited,sorted,comparator);
-
- list.clear();
- list.addAll(sorted);
- }
-
- /** Visit an item to be sorted.
- * @param item The item to be visited
- * @param visited The Set of items already visited
- * @param sorted The list to sort items into
- * @param comparator A comparator used to sort dependencies.
- */
- private void visit(T item, Set<T> visited, List<T> sorted,Comparator<T> comparator)
- {
- // If the item has not been visited
- if(!visited.contains(item))
- {
- // We are visiting it now, so add it to the visited set
- visited.add(item);
-
- // Lookup the items dependencies
- Set<T> dependencies = _dependencies.get(item);
- if (dependencies!=null)
- {
- // Sort the dependencies
- SortedSet<T> ordered_deps = new TreeSet<>(comparator);
- ordered_deps.addAll(dependencies);
-
- // recursively visit each dependency
- for (T d:ordered_deps)
- visit(d,visited,sorted,comparator);
- }
-
- // Now that we have visited all our dependencies, they and their
- // dependencies will have been added to the sorted list. So we can
- // now add the current item and it will be after its dependencies
- sorted.add(item);
- }
- else if (!sorted.contains(item))
- // If we have already visited an item, but it has not yet been put in the
- // sorted list, then we must be in a cycle!
- throw new IllegalStateException("cyclic at "+item);
- }
-
-
- /** A comparator that is used to sort dependencies in the order they
- * were in the original list. This ensures that dependencies are visited
- * in the original order and no needless reordering takes place.
- * @param <T>
- */
- private static class InitialOrderComparitor<T> implements Comparator<T>
- {
- private final Map<T,Integer> _indexes = new HashMap<>();
- InitialOrderComparitor(T[] initial)
- {
- int i=0;
- for (T t : initial)
- _indexes.put(t,i++);
- }
-
- InitialOrderComparitor(Collection<T> initial)
- {
- int i=0;
- for (T t : initial)
- _indexes.put(t,i++);
- }
-
- @Override
- public int compare(T o1, T o2)
- {
- Integer i1=_indexes.get(o1);
- Integer i2=_indexes.get(o2);
- if (i1==null || i2==null || i1.equals(o2))
- return 0;
- if (i1<i2)
- return -1;
- return 1;
- }
-
- }
-
- @Override
- public String toString()
- {
- return "TopologicalSort "+_dependencies;
- }
-}
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/PropertyPassingTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/PropertyPassingTest.java
index e325e09..0726167 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/PropertyPassingTest.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/PropertyPassingTest.java
@@ -165,6 +165,8 @@
cp.append(MavenTestingUtils.getProjectDir("target/classes"));
cp.append(pathSep);
cp.append(MavenTestingUtils.getProjectDir("target/test-classes"));
+ cp.append(pathSep);
+ cp.append(MavenTestingUtils.getProjectDir("../jetty-util/target/classes")); // TODO horrible hack!
return cp.toString();
}
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/TopologicalSort.java b/jetty-util/src/main/java/org/eclipse/jetty/util/TopologicalSort.java
index 44b1933..4f86b45 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/TopologicalSort.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/TopologicalSort.java
@@ -29,9 +29,8 @@
import java.util.TreeSet;
-
/**
- * Topological Sort a list or array.
+ * Topological sort a list or array.
* <p>A Topological sort is used when you have a partial ordering expressed as
* dependencies between elements (also often represented as edges in a directed
* acyclic graph). A Topological sort should not be used when you have a total
@@ -75,7 +74,7 @@
{
List<T> sorted = new ArrayList<>();
Set<T> visited = new HashSet<>();
- Comparator<T> comparator = new InitialOrderComparitor<>(array);
+ Comparator<T> comparator = new InitialOrderComparator<>(array);
// Visit all items in the array
for (T t : array)
@@ -93,7 +92,7 @@
{
List<T> sorted = new ArrayList<>();
Set<T> visited = new HashSet<>();
- Comparator<T> comparator = new InitialOrderComparitor<>(list);
+ Comparator<T> comparator = new InitialOrderComparator<>(list);
// Visit all items in the list
for (T t : list)
@@ -147,17 +146,17 @@
* in the original order and no needless reordering takes place.
* @param <T>
*/
- private static class InitialOrderComparitor<T> implements Comparator<T>
+ private static class InitialOrderComparator<T> implements Comparator<T>
{
private final Map<T,Integer> _indexes = new HashMap<>();
- InitialOrderComparitor(T[] initial)
+ InitialOrderComparator(T[] initial)
{
int i=0;
for (T t : initial)
_indexes.put(t,i++);
}
- InitialOrderComparitor(Collection<T> initial)
+ InitialOrderComparator(Collection<T> initial)
{
int i=0;
for (T t : initial)