diff --git a/client/pom.xml b/client/pom.xml
new file mode 100644
index 00000000..99e7e62e
--- /dev/null
+++ b/client/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ org.jboss.fuse.mvnd
+ mvnd
+ 0.1-SNAPSHOT
+
+
+ mvnd-client
+
+ jar
+ Maven Daemon - Client
+
+
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+ org.jline
+ jline-terminal
+
+
+ org.jline
+ jline-terminal-jansi
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ test
+
+
+
+
+
+
+ ${basedir}/src/main/resources
+ true
+
+
+
+
+ io.takari.maven.plugins
+ takari-lifecycle-plugin
+
+
+
+ sisu-index
+
+ process-classes
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/BufferCaster.java b/client/src/main/java/org/jboss/fuse/mvnd/client/BufferCaster.java
similarity index 96%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/BufferCaster.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/BufferCaster.java
index bf996e3d..5361d655 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/BufferCaster.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/BufferCaster.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.nio.Buffer;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Client.java b/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
similarity index 87%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Client.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
index f87b3cf7..2e51dace 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Client.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/Client.java
@@ -13,9 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
-
-import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
+package org.jboss.fuse.mvnd.client;
import java.io.IOException;
import java.io.InputStream;
@@ -28,13 +26,14 @@ import java.util.List;
import java.util.Optional;
import java.util.Properties;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
-import org.apache.maven.cli.CLIReportingUtils;
-import org.jboss.fuse.mvnd.daemon.ClientOutput.TerminalOutput;
-import org.jboss.fuse.mvnd.daemon.Message.BuildEvent;
-import org.jboss.fuse.mvnd.daemon.Message.BuildException;
-import org.jboss.fuse.mvnd.daemon.Message.BuildMessage;
-import org.jboss.fuse.mvnd.daemon.Message.MessageSerializer;
+import org.fusesource.jansi.Ansi;
+import org.jboss.fuse.mvnd.client.ClientOutput.TerminalOutput;
+import org.jboss.fuse.mvnd.client.Message.BuildEvent;
+import org.jboss.fuse.mvnd.client.Message.BuildException;
+import org.jboss.fuse.mvnd.client.Message.BuildMessage;
+import org.jboss.fuse.mvnd.client.Message.MessageSerializer;
import org.jboss.fuse.mvnd.jpm.Process;
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
import org.jboss.fuse.mvnd.jpm.ScriptUtils;
@@ -45,6 +44,10 @@ public class Client {
private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);
public static final String DAEMON_DEBUG = "daemon.debug";
+ public static final String DAEMON_IDLE_TIMEOUT = "daemon.idleTimeout";
+ public static final int DEFAULT_IDLE_TIMEOUT = (int) TimeUnit.HOURS.toMillis(3);
+ public static final int DEFAULT_PERIODIC_CHECK_INTERVAL_MILLIS = 10 * 1000;
+ public static final int CANCEL_TIMEOUT = 10 * 1000;
private final Layout layout;
private final Optional clientLayout;
@@ -82,7 +85,7 @@ public class Client {
final List args = new ArrayList<>(argv);
// Print version if needed
- boolean version = args.remove("-v") || args.remove("-version") || args.remove("--version");
+ boolean version = args.contains("-v") || args.contains("-version") || args.contains("--version");
boolean showVersion = args.contains("-V") || args.contains("--show-version");
boolean debug = args.contains("-X") || args.contains("--debug");
if (version || showVersion || debug) {
@@ -90,13 +93,9 @@ public class Client {
try (InputStream is = Client.class.getResourceAsStream("build.properties")) {
props.load(is);
}
- String v = buffer().strong("Maven Daemon " + props.getProperty("version")).toString()
- + System.getProperty("line.separator")
- + CLIReportingUtils.showVersion();
+ String v = Ansi.ansi().bold().a("Maven Daemon " + props.getProperty("version")).reset().toString();
output.log(v);
- if (version) {
- return new ClientResult(argv, true, output);
- }
+ /* Do not return, rather pass -v to the server so that the client module does not need to depend on any Maven artifacts */
}
final Path javaHome = layout.javaHome();
@@ -207,7 +206,7 @@ public class Client {
Path workingDir = layout.userDir();
String command = "";
try {
- String url = ServerMain.class.getClassLoader().getResource(Server.class.getName().replace('.', '/') + ".class").toString();
+ String url = Client.class.getClassLoader().getResource(Client.class.getName().replace('.', '/') + ".class").toString();
String classpath = url.substring("file:jar:".length(), url.indexOf('!'));
String java = ScriptUtils.isWindows() ? "bin\\java.exe" : "bin/java";
List args = new ArrayList<>();
@@ -221,8 +220,9 @@ public class Client {
args.add("-Dlogback.configurationFile=logback.xml");
args.add("-Ddaemon.uid=" + uid);
args.add("-Xmx4g");
- if (System.getProperty(Server.DAEMON_IDLE_TIMEOUT) != null) {
- args.add("-D" + Server.DAEMON_IDLE_TIMEOUT + "=" + System.getProperty(Server.DAEMON_IDLE_TIMEOUT));
+ final String timeout = System.getProperty(DAEMON_IDLE_TIMEOUT);
+ if (timeout != null) {
+ args.add("-D" + DAEMON_IDLE_TIMEOUT + "=" + timeout);
}
args.add("\"-Dmaven.multiModuleProjectDirectory=" + layout.multiModuleProjectDirectory().toString() + "\"");
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientLayout.java b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientLayout.java
similarity index 94%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientLayout.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/ClientLayout.java
index 7ef69dd1..2fcb8593 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientLayout.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientLayout.java
@@ -1,4 +1,4 @@
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.nio.file.Path;
import java.util.Objects;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientOutput.java b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java
similarity index 96%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientOutput.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java
index 199d9501..07d16af1 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientOutput.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientOutput.java
@@ -1,4 +1,4 @@
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.IOException;
import java.io.Writer;
@@ -11,8 +11,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.function.Consumer;
-import org.apache.commons.cli.UnrecognizedOptionException;
-import org.jboss.fuse.mvnd.daemon.Message.BuildException;
+import org.jboss.fuse.mvnd.client.Message.BuildException;
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
@@ -109,7 +108,7 @@ public interface ClientOutput extends AutoCloseable {
display.update(Collections.emptyList(), 0);
final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED);
final String msg;
- if (UnrecognizedOptionException.class.getName().equals(error.getClassName())) {
+ if ("org.apache.commons.cli.UnrecognizedOptionException".equals(error.getClassName())) {
msg = "Unable to parse command line options: " + error.getMessage();
} else {
msg = error.getClassName() + ": " + error.getMessage();
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientResult.java b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientResult.java
similarity index 97%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientResult.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/ClientResult.java
index f338e402..632f6bdc 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ClientResult.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/ClientResult.java
@@ -1,4 +1,4 @@
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.util.ArrayList;
import java.util.List;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonClientConnection.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonClientConnection.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonClientConnection.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonClientConnection.java
index 98281e89..ec10a747 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonClientConnection.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonClientConnection.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonCompatibilitySpec.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonCompatibilitySpec.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonCompatibilitySpec.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonCompatibilitySpec.java
index 0a3bde44..49c73fb9 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonCompatibilitySpec.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonCompatibilitySpec.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.nio.file.Paths;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnection.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnection.java
similarity index 99%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnection.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnection.java
index ad030434..871daf5e 100755
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnection.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnection.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.Closeable;
import java.io.DataInputStream;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnector.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java
similarity index 99%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnector.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java
index 687824f6..773892e7 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonConnector.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonConnector.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -32,7 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.lang.Thread.sleep;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Canceled;
+import static org.jboss.fuse.mvnd.client.DaemonState.Canceled;
public class DaemonConnector {
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonDiagnostics.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonDiagnostics.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonDiagnostics.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonDiagnostics.java
index 430b834d..20fcd19c 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonDiagnostics.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonDiagnostics.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.BufferedReader;
import java.io.IOException;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonException.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonException.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonException.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonException.java
index 62e72f5b..09feb92e 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonException.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonException.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
public class DaemonException extends RuntimeException {
diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonExpirationStatus.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonExpirationStatus.java
new file mode 100644
index 00000000..129dc9f0
--- /dev/null
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonExpirationStatus.java
@@ -0,0 +1,14 @@
+package org.jboss.fuse.mvnd.client;
+
+/**
+ * Expiration status for daemon expiration check results.
+ * Note that order here is important, higher ordinal statuses
+ * take precedent over lower ordinal statuses when aggregating
+ * results.
+ */
+public enum DaemonExpirationStatus {
+ DO_NOT_EXPIRE,
+ QUIET_EXPIRE,
+ GRACEFUL_EXPIRE,
+ IMMEDIATE_EXPIRE;
+}
\ No newline at end of file
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonInfo.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonInfo.java
similarity index 95%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonInfo.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonInfo.java
index 45f8b00f..ea5db8cb 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonInfo.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonInfo.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
+
+import static org.jboss.fuse.mvnd.client.DaemonState.Busy;
+import static org.jboss.fuse.mvnd.client.DaemonState.Idle;
import java.util.List;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Busy;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Idle;
-
public class DaemonInfo {
private final String uid;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonRegistry.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonRegistry.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonRegistry.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonRegistry.java
index 60673986..e4bb9423 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonRegistry.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonRegistry.java
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
+
+import static org.jboss.fuse.mvnd.client.DaemonState.Canceled;
+import static org.jboss.fuse.mvnd.client.DaemonState.Idle;
import java.io.File;
import java.io.IOException;
@@ -37,15 +40,11 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
-import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Canceled;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Idle;
-
/**
* Access to daemon registry files. Useful also for testing.
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStarter.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStarter.java
similarity index 94%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStarter.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStarter.java
index 217bbecd..1f99d2fc 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStarter.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStarter.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
public interface DaemonStarter {
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonState.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonState.java
similarity index 95%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonState.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonState.java
index 56ac8c4e..b48ebc2e 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonState.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonState.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
public enum DaemonState {
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStopEvent.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStopEvent.java
similarity index 95%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStopEvent.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStopEvent.java
index 397c7163..5c53d15d 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonStopEvent.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DaemonStopEvent.java
@@ -14,15 +14,13 @@
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;
import java.util.Objects;
-import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
-
/**
* Information regarding when and why a daemon was stopped.
*/
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Layout.java b/client/src/main/java/org/jboss/fuse/mvnd/client/Layout.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Layout.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/Layout.java
index c9ada49a..152ab9a8 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Layout.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/Layout.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.nio.file.Path;
import java.nio.file.Paths;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Message.java b/client/src/main/java/org/jboss/fuse/mvnd/client/Message.java
similarity index 90%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Message.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/Message.java
index 08be669e..e263ea40 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Message.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/Message.java
@@ -13,23 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.io.UTFDataFormatException;
import java.util.ArrayList;
import java.util.List;
-import org.codehaus.plexus.util.ExceptionUtils;
-
public abstract class Message {
final long timestamp = System.nanoTime();
- long timestamp() {
+ public long timestamp() {
return timestamp;
}
@@ -72,7 +72,13 @@ public abstract class Message {
final String stackTrace;
public BuildException(Throwable t) {
- this(t.getMessage(), t.getClass().getName(), ExceptionUtils.getStackTrace(t));
+ this(t.getMessage(), t.getClass().getName(), getStackTrace(t));
+ }
+
+ static String getStackTrace(Throwable t) {
+ StringWriter sw = new StringWriter();
+ t.printStackTrace(new PrintWriter(sw, true));
+ return sw.toString();
}
public BuildException(String message, String className, String stackTrace) {
@@ -104,7 +110,7 @@ public abstract class Message {
}
public static class BuildEvent extends Message {
- enum Type {
+ public enum Type {
BuildStarted, BuildStopped, ProjectStarted, ProjectStopped, MojoStarted, MojoStopped
}
final Type type;
@@ -286,7 +292,7 @@ public abstract class Message {
final int a = byteBuf[i++] & 0xff;
if (a < 0x80) {
// low bit clear
- chars[charIdx ++] = (char) a;
+ chars[charIdx++] = (char) a;
} else if (a < 0xc0) {
throw new UTFDataFormatException(INVALID_BYTE);
} else if (a < 0xe0) {
@@ -297,11 +303,11 @@ public abstract class Message {
}
i = 0;
}
- final int b = byteBuf[i ++] & 0xff;
+ final int b = byteBuf[i++] & 0xff;
if ((b & 0xc0) != 0x80) {
throw new UTFDataFormatException(INVALID_BYTE);
}
- chars[charIdx ++] = (char) ((a & 0x1f) << 6 | b & 0x3f);
+ chars[charIdx++] = (char) ((a & 0x1f) << 6 | b & 0x3f);
} else if (a < 0xf0) {
if (i == cnt) {
cnt = input.read(byteBuf, 0, Math.min(UTF_BUFS_BYTE_CNT, len - charIdx));
@@ -310,7 +316,7 @@ public abstract class Message {
}
i = 0;
}
- final int b = byteBuf[i ++] & 0xff;
+ final int b = byteBuf[i++] & 0xff;
if ((b & 0xc0) != 0x80) {
throw new UTFDataFormatException(INVALID_BYTE);
}
@@ -321,11 +327,11 @@ public abstract class Message {
}
i = 0;
}
- final int c = byteBuf[i ++] & 0xff;
+ final int c = byteBuf[i++] & 0xff;
if ((c & 0xc0) != 0x80) {
throw new UTFDataFormatException(INVALID_BYTE);
}
- chars[charIdx ++] = (char) ((a & 0x0f) << 12 | (b & 0x3f) << 6 | c & 0x3f);
+ chars[charIdx++] = (char) ((a & 0x0f) << 12 | (b & 0x3f) << 6 | c & 0x3f);
} else {
throw new UTFDataFormatException(INVALID_BYTE);
}
@@ -339,16 +345,16 @@ public abstract class Message {
int strIdx = 0;
int byteIdx = 0;
while (strIdx < length) {
- final char c = s.charAt(strIdx ++);
+ final char c = s.charAt(strIdx++);
if (c > 0 && c <= 0x7f) {
- byteBuf[byteIdx ++] = (byte) c;
+ byteBuf[byteIdx++] = (byte) c;
} else if (c <= 0x07ff) {
- byteBuf[byteIdx ++] = (byte)(0xc0 | 0x1f & c >> 6);
- byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c);
+ byteBuf[byteIdx++] = (byte) (0xc0 | 0x1f & c >> 6);
+ byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c);
} else {
- byteBuf[byteIdx ++] = (byte)(0xe0 | 0x0f & c >> 12);
- byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c >> 6);
- byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c);
+ byteBuf[byteIdx++] = (byte) (0xe0 | 0x0f & c >> 12);
+ byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c >> 6);
+ byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c);
}
if (byteIdx > UTF_BUFS_BYTE_CNT - 4) {
output.write(byteBuf, 0, byteIdx);
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Serializer.java b/client/src/main/java/org/jboss/fuse/mvnd/client/Serializer.java
similarity index 97%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Serializer.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/Serializer.java
index 2d67bb3e..7ecf74da 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Serializer.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/Serializer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.io.DataInputStream;
import java.io.DataOutputStream;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ServerMain.java b/client/src/main/java/org/jboss/fuse/mvnd/client/ServerMain.java
similarity index 98%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ServerMain.java
rename to client/src/main/java/org/jboss/fuse/mvnd/client/ServerMain.java
index 070e9fdc..45bd5516 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/ServerMain.java
+++ b/client/src/main/java/org/jboss/fuse/mvnd/client/ServerMain.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.fuse.mvnd.daemon;
+package org.jboss.fuse.mvnd.client;
import java.net.MalformedURLException;
import java.net.URL;
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/jpm/Process.java b/client/src/main/java/org/jboss/fuse/mvnd/jpm/Process.java
similarity index 100%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/jpm/Process.java
rename to client/src/main/java/org/jboss/fuse/mvnd/jpm/Process.java
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/jpm/ProcessImpl.java b/client/src/main/java/org/jboss/fuse/mvnd/jpm/ProcessImpl.java
similarity index 100%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/jpm/ProcessImpl.java
rename to client/src/main/java/org/jboss/fuse/mvnd/jpm/ProcessImpl.java
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/jpm/ScriptUtils.java b/client/src/main/java/org/jboss/fuse/mvnd/jpm/ScriptUtils.java
similarity index 100%
rename from daemon/src/main/java/org/jboss/fuse/mvnd/jpm/ScriptUtils.java
rename to client/src/main/java/org/jboss/fuse/mvnd/jpm/ScriptUtils.java
diff --git a/daemon/src/main/resources/org/jboss/fuse/mvnd/daemon/build.properties b/client/src/main/resources/org/jboss/fuse/mvnd/client/build.properties
similarity index 100%
rename from daemon/src/main/resources/org/jboss/fuse/mvnd/daemon/build.properties
rename to client/src/main/resources/org/jboss/fuse/mvnd/client/build.properties
diff --git a/daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/unix/start.sh b/client/src/main/resources/org/jboss/fuse/mvnd/jpm/unix/start.sh
similarity index 100%
rename from daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/unix/start.sh
rename to client/src/main/resources/org/jboss/fuse/mvnd/jpm/unix/start.sh
diff --git a/daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/destroy.vbs b/client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/destroy.vbs
similarity index 100%
rename from daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/destroy.vbs
rename to client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/destroy.vbs
diff --git a/daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/running.vbs b/client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/running.vbs
similarity index 100%
rename from daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/running.vbs
rename to client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/running.vbs
diff --git a/daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/start.vbs b/client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/start.vbs
similarity index 100%
rename from daemon/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/start.vbs
rename to client/src/main/resources/org/jboss/fuse/mvnd/jpm/windows/start.vbs
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java b/client/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java
similarity index 85%
rename from daemon/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java
rename to client/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java
index fb1e1c68..b22d0cea 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java
+++ b/client/src/test/java/org/jboss/fuse/mvnd/daemon/DaemonRegistryTest.java
@@ -22,10 +22,13 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.Random;
-import org.junit.Test;
+import org.jboss.fuse.mvnd.client.DaemonInfo;
+import org.jboss.fuse.mvnd.client.DaemonRegistry;
+import org.jboss.fuse.mvnd.client.DaemonState;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class DaemonRegistryTest {
diff --git a/daemon/pom.xml b/daemon/pom.xml
index c8ca7333..1a762d6d 100644
--- a/daemon/pom.xml
+++ b/daemon/pom.xml
@@ -14,72 +14,49 @@
Maven Daemon
+
+ org.jboss.fuse.mvnd
+ mvnd-client
+
org.apache.maven
maven-embedder
- ${mavenVersion}
io.takari.aether
takari-local-repository
- ${takariLocalRepositoryVersion}
ch.qos.logback
logback-classic
- ${logbackVersion}
org.slf4j
log4j-over-slf4j
- ${slf4jVersion}
org.slf4j
jcl-over-slf4j
- ${slf4jVersion}
org.slf4j
jul-to-slf4j
- ${slf4jVersion}
org.jline
jline-terminal
- ${jlineVersion}
-
-
- org.jline
- jline-terminal-jansi
- ${jlineVersion}
org.codehaus.groovy
groovy
- ${groovyVersion}
- junit
- junit
- ${junitVersion}
- test
-
-
- io.takari.maven.plugins
- takari-plugin-testing
- ${pluginTestingVersion}
- test
-
-
- io.takari.maven.plugins
- takari-plugin-integration-testing
- ${pluginTestingVersion}
- pom
+ org.junit.jupiter
+ junit-jupiter
test
@@ -95,7 +72,6 @@
io.takari.maven.plugins
takari-lifecycle-plugin
- ${takariLifecycleVersion}
@@ -105,19 +81,9 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${mavenCompilerPluginVersion}
-
- 1.8
- 1.8
-
-
io.takari.maven.plugins
provisio-maven-plugin
- ${takariProvisioVersion}
maven-distro
@@ -131,22 +97,6 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration-test
- integration-test
-
- test
-
-
- **/*IT.java
-
-
-
-
diff --git a/daemon/src/main/distro/bin/mvnd b/daemon/src/main/distro/bin/mvnd
index d4736f2b..f736d5fc 100755
--- a/daemon/src/main/distro/bin/mvnd
+++ b/daemon/src/main/distro/bin/mvnd
@@ -104,7 +104,7 @@ fi
DAEMON_JAR=`echo "${MVND_HOME}"/lib/ext/*.jar "${MVND_HOME}"/lib/*.jar`
DAEMON_JAR=$(echo $DAEMON_JAR | sed -e 's/ /:/g')
-DAEMON_LAUNCHER=org.jboss.fuse.mvnd.daemon.Client
+DAEMON_LAUNCHER=org.jboss.fuse.mvnd.client.Client
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
diff --git a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
index c58d9c40..9939d27d 100644
--- a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
+++ b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
@@ -89,6 +89,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
import org.codehaus.plexus.logging.LoggerManager;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.transfer.TransferListener;
+import org.jboss.fuse.mvnd.logging.smart.AbstractLoggingSpy;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -165,8 +166,8 @@ public class DaemonMavenCli
cli(cliRequest);
properties(cliRequest);
logging(cliRequest);
- version( cliRequest );
configure(cliRequest);
+ version( cliRequest );
toolchains(cliRequest);
populateRequest( cliRequest );
encryption( cliRequest );
@@ -274,11 +275,6 @@ public class DaemonMavenCli
throw new ExitException( 0 );
}
- if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
- {
- System.out.println( CLIReportingUtils.showVersion() );
- throw new ExitException( 0 );
- }
}
private CommandLine cliMerge( CommandLine mavenArgs, CommandLine mavenConfig )
@@ -391,11 +387,14 @@ public class DaemonMavenCli
}
- private void version( CliRequest cliRequest )
+ private void version( CliRequest cliRequest ) throws ExitException
{
- if ( cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.SHOW_VERSION ) )
+ if ( cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
{
- System.out.println( CLIReportingUtils.showVersion() );
+ AbstractLoggingSpy.instance().append(null, CLIReportingUtils.showVersion());
+ if (cliRequest.commandLine.hasOption( CLIManager.VERSION )) {
+ throw new ExitException( 0 );
+ }
}
}
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonExpiration.java b/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonExpiration.java
index 89234129..3f9e0d60 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonExpiration.java
+++ b/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/DaemonExpiration.java
@@ -23,10 +23,15 @@ import java.util.Objects;
import java.util.function.ToLongFunction;
import java.util.stream.Collectors;
+import org.jboss.fuse.mvnd.client.DaemonCompatibilitySpec;
+import org.jboss.fuse.mvnd.client.DaemonExpirationStatus;
+import org.jboss.fuse.mvnd.client.DaemonInfo;
+import org.jboss.fuse.mvnd.client.DaemonState;
+
+import static org.jboss.fuse.mvnd.client.DaemonExpirationStatus.DO_NOT_EXPIRE;
+import static org.jboss.fuse.mvnd.client.DaemonExpirationStatus.GRACEFUL_EXPIRE;
+import static org.jboss.fuse.mvnd.client.DaemonExpirationStatus.QUIET_EXPIRE;
import static org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationResult.NOT_TRIGGERED;
-import static org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus.DO_NOT_EXPIRE;
-import static org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus.GRACEFUL_EXPIRE;
-import static org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus.QUIET_EXPIRE;
public class DaemonExpiration {
@@ -225,17 +230,4 @@ public class DaemonExpiration {
}
}
-
- /**
- * Expiration status for daemon expiration check results.
- * Note that order here is important, higher ordinal statuses
- * take precedent over lower ordinal statuses when aggregating
- * results.
- */
- public enum DaemonExpirationStatus {
- DO_NOT_EXPIRE,
- QUIET_EXPIRE,
- GRACEFUL_EXPIRE,
- IMMEDIATE_EXPIRE;
- }
}
diff --git a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Server.java b/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Server.java
index 2e1853b3..e133dd49 100644
--- a/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Server.java
+++ b/daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Server.java
@@ -15,6 +15,10 @@
*/
package org.jboss.fuse.mvnd.daemon;
+import static org.jboss.fuse.mvnd.client.DaemonState.Busy;
+import static org.jboss.fuse.mvnd.client.DaemonState.StopRequested;
+import static org.jboss.fuse.mvnd.client.DaemonState.Stopped;
+
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
@@ -37,31 +41,30 @@ import java.util.concurrent.locks.ReentrantLock;
import org.apache.maven.cli.CliRequest;
import org.apache.maven.cli.CliRequestBuilder;
import org.apache.maven.cli.DaemonMavenCli;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.DaemonConnection;
+import org.jboss.fuse.mvnd.client.DaemonException;
+import org.jboss.fuse.mvnd.client.DaemonExpirationStatus;
+import org.jboss.fuse.mvnd.client.DaemonInfo;
+import org.jboss.fuse.mvnd.client.DaemonRegistry;
+import org.jboss.fuse.mvnd.client.DaemonState;
+import org.jboss.fuse.mvnd.client.DaemonStopEvent;
+import org.jboss.fuse.mvnd.client.Layout;
+import org.jboss.fuse.mvnd.client.Message;
+import org.jboss.fuse.mvnd.client.Message.BuildEvent;
+import org.jboss.fuse.mvnd.client.Message.BuildException;
+import org.jboss.fuse.mvnd.client.Message.BuildMessage;
+import org.jboss.fuse.mvnd.client.Message.BuildRequest;
+import org.jboss.fuse.mvnd.client.Message.MessageSerializer;
+import org.jboss.fuse.mvnd.client.Message.BuildEvent.Type;
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationResult;
-import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStrategy;
-import org.jboss.fuse.mvnd.daemon.Message.BuildEvent;
-import org.jboss.fuse.mvnd.daemon.Message.BuildEvent.Type;
-import org.jboss.fuse.mvnd.daemon.Message.BuildException;
-import org.jboss.fuse.mvnd.daemon.Message.BuildMessage;
-import org.jboss.fuse.mvnd.daemon.Message.BuildRequest;
-import org.jboss.fuse.mvnd.daemon.Message.MessageSerializer;
import org.jboss.fuse.mvnd.logging.smart.AbstractLoggingSpy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Busy;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.StopRequested;
-import static org.jboss.fuse.mvnd.daemon.DaemonState.Stopped;
-
public class Server implements AutoCloseable, Runnable {
- public static final String DAEMON_IDLE_TIMEOUT = "daemon.idleTimeout";
-
- public static final int DEFAULT_IDLE_TIMEOUT = (int) TimeUnit.HOURS.toMillis(3);
- public static final int DEFAULT_PERIODIC_CHECK_INTERVAL_MILLIS = 10 * 1000;
-
- public static final int CANCEL_TIMEOUT = 10 * 1000;
private static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
@@ -88,10 +91,10 @@ public class Server implements AutoCloseable, Runnable {
socket = ServerSocketChannel.open().bind(new InetSocketAddress(0));
int idleTimeout;
- if (System.getProperty(DAEMON_IDLE_TIMEOUT) != null) {
- idleTimeout = Integer.parseInt(System.getProperty(DAEMON_IDLE_TIMEOUT));
+ if (System.getProperty(Client.DAEMON_IDLE_TIMEOUT) != null) {
+ idleTimeout = Integer.parseInt(System.getProperty(Client.DAEMON_IDLE_TIMEOUT));
} else {
- idleTimeout = DEFAULT_IDLE_TIMEOUT;
+ idleTimeout = Client.DEFAULT_IDLE_TIMEOUT;
}
executor = Executors.newScheduledThreadPool(1);
strategy = DaemonExpiration.master();
@@ -334,7 +337,7 @@ public class Server implements AutoCloseable, Runnable {
}
private void cancelNow() {
- long time = System.currentTimeMillis() + CANCEL_TIMEOUT;
+ long time = System.currentTimeMillis() + Client.CANCEL_TIMEOUT;
// LOGGER.debug("Cancel requested: will wait for daemon to become idle.");
// try {
@@ -382,9 +385,9 @@ public class Server implements AutoCloseable, Runnable {
try {
LOGGER.info("Executing request");
CliRequest req = new CliRequestBuilder()
- .arguments(buildRequest.args)
- .workingDirectory(Paths.get(buildRequest.workingDir))
- .projectDirectory(Paths.get(buildRequest.projectDir))
+ .arguments(buildRequest.getArgs())
+ .workingDirectory(Paths.get(buildRequest.getWorkingDir()))
+ .projectDirectory(Paths.get(buildRequest.getProjectDir()))
.build();
PriorityBlockingQueue queue = new PriorityBlockingQueue(64,
diff --git a/daemon/src/main/provisio/maven-distro.xml b/daemon/src/main/provisio/maven-distro.xml
index db14aa7d..fe9e3351 100644
--- a/daemon/src/main/provisio/maven-distro.xml
+++ b/daemon/src/main/provisio/maven-distro.xml
@@ -1,14 +1,14 @@
-
+
-
+
@@ -16,7 +16,7 @@
-
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/AbstractSmartBuilderTest.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/AbstractSmartBuilderTest.java
index 7968b8ea..be6743b2 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/AbstractSmartBuilderTest.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/AbstractSmartBuilderTest.java
@@ -5,11 +5,11 @@ import java.util.Collection;
import java.util.HashSet;
import org.apache.maven.project.MavenProject;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
abstract class AbstractSmartBuilderTest {
protected void assertProjects(Collection actual, MavenProject... expected) {
- Assert.assertEquals(new HashSet(Arrays.asList(expected)), new HashSet<>(actual));
+ Assertions.assertEquals(new HashSet(Arrays.asList(expected)), new HashSet<>(actual));
}
protected MavenProject newProject(String artifactId) {
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/DependencyGraphTest.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/DependencyGraphTest.java
index 101fc1a1..c240400d 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/DependencyGraphTest.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/DependencyGraphTest.java
@@ -20,8 +20,8 @@ import java.util.HashSet;
import java.util.stream.Collectors;
import org.apache.maven.project.MavenProject;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class DependencyGraphTest extends AbstractSmartBuilderTest {
@@ -31,7 +31,7 @@ public class DependencyGraphTest extends AbstractSmartBuilderTest {
TestProjectDependencyGraph graph = new TestProjectDependencyGraph(a, b, c);
graph.addDependency(b, a);
DependencyGraph dp = DependencyGraph.fromMaven(graph, "a before c");
- Assert.assertEquals(new HashSet<>(Arrays.asList(b, c)),
+ Assertions.assertEquals(new HashSet<>(Arrays.asList(b, c)),
dp.getDownstreamProjects(a).collect(Collectors.toSet()));
}
}
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectComparatorTest.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectComparatorTest.java
index 2fb6e107..3120026b 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectComparatorTest.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectComparatorTest.java
@@ -7,8 +7,8 @@ import java.util.Queue;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.maven.project.MavenProject;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
@@ -28,9 +28,9 @@ public class ProjectComparatorTest extends AbstractSmartBuilderTest {
queue.add(b);
queue.add(c);
- Assert.assertEquals(a, queue.poll());
- Assert.assertEquals(c, queue.poll());
- Assert.assertEquals(b, queue.poll());
+ Assertions.assertEquals(a, queue.poll());
+ Assertions.assertEquals(c, queue.poll());
+ Assertions.assertEquals(b, queue.poll());
}
@Test
@@ -52,9 +52,9 @@ public class ProjectComparatorTest extends AbstractSmartBuilderTest {
queue.add(b);
queue.add(c);
- Assert.assertEquals(c, queue.poll());
- Assert.assertEquals(a, queue.poll());
- Assert.assertEquals(b, queue.poll());
+ Assertions.assertEquals(c, queue.poll());
+ Assertions.assertEquals(a, queue.poll());
+ Assertions.assertEquals(b, queue.poll());
}
}
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectExecutorServiceTest.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectExecutorServiceTest.java
index 1c11a06e..f17d3df3 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectExecutorServiceTest.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ProjectExecutorServiceTest.java
@@ -11,8 +11,8 @@ import java.util.concurrent.atomic.AtomicLong;
import com.google.common.util.concurrent.Monitor;
import org.apache.maven.project.MavenProject;
import org.jboss.fuse.mvnd.builder.ProjectExecutorService.ProjectRunnable;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
@@ -70,7 +70,7 @@ public class ProjectExecutorServiceTest extends AbstractSmartBuilderTest {
executor.resume();
executor.awaitShutdown();
- Assert.assertEquals(Arrays.asList(a, c, a, b), executed);
+ Assertions.assertEquals(Arrays.asList(a, c, a, b), executed);
}
// copy&paste from ThreadPoolExecutor javadoc (use of Guava is a nice touch there)
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ReactorBuildQueueTest.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ReactorBuildQueueTest.java
index 0a54abfb..0c62fef3 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ReactorBuildQueueTest.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/ReactorBuildQueueTest.java
@@ -1,8 +1,8 @@
package org.jboss.fuse.mvnd.builder;
import org.apache.maven.project.MavenProject;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
@@ -16,10 +16,10 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
assertProjects(schl.getRootProjects(), a, c);
- Assert.assertFalse(schl.isEmpty());
+ Assertions.assertFalse(schl.isEmpty());
assertProjects(schl.onProjectFinish(a), b);
- Assert.assertTrue(schl.isEmpty());
+ Assertions.assertTrue(schl.isEmpty());
}
@Test
@@ -31,7 +31,7 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
assertProjects(schl.getRootProjects(), a, b, c);
- Assert.assertTrue(schl.isEmpty());
+ Assertions.assertTrue(schl.isEmpty());
}
@Test
@@ -45,12 +45,12 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
assertProjects(schl.getRootProjects(), a, c);
- Assert.assertFalse(schl.isEmpty());
+ Assertions.assertFalse(schl.isEmpty());
assertProjects(schl.onProjectFinish(a), new MavenProject[0]);
- Assert.assertFalse(schl.isEmpty());
+ Assertions.assertFalse(schl.isEmpty());
assertProjects(schl.onProjectFinish(c), b);
- Assert.assertTrue(schl.isEmpty());
+ Assertions.assertTrue(schl.isEmpty());
}
}
diff --git a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/TestProjectDependencyGraph.java b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/TestProjectDependencyGraph.java
index 69b1b453..760ceda5 100644
--- a/daemon/src/test/java/org/jboss/fuse/mvnd/builder/TestProjectDependencyGraph.java
+++ b/daemon/src/test/java/org/jboss/fuse/mvnd/builder/TestProjectDependencyGraph.java
@@ -8,7 +8,7 @@ import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.project.MavenProject;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
public class TestProjectDependencyGraph implements ProjectDependencyGraph {
@@ -36,13 +36,13 @@ public class TestProjectDependencyGraph implements ProjectDependencyGraph {
@Override
public List getDownstreamProjects(MavenProject project, boolean transitive) {
- Assert.assertFalse("not implemented", transitive);
+ Assertions.assertFalse(transitive, "not implemented");
return downstream.get(project);
}
@Override
public List getUpstreamProjects(MavenProject project, boolean transitive) {
- Assert.assertFalse("not implemented", transitive);
+ Assertions.assertFalse(transitive, "not implemented");
return upstream.get(project);
}
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
index 90334fed..4a77986f 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/MultiModuleTest.java
@@ -10,10 +10,10 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.assertj.EqualsInOrderAmongOthers;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
-import org.jboss.fuse.mvnd.daemon.Client;
-import org.jboss.fuse.mvnd.daemon.ClientLayout;
-import org.jboss.fuse.mvnd.daemon.ClientOutput;
-import org.jboss.fuse.mvnd.daemon.Layout;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.ClientLayout;
+import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.client.Layout;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
index ba0e23bc..d8cff858 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/SingleModuleTest.java
@@ -9,10 +9,10 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
-import org.jboss.fuse.mvnd.daemon.Client;
-import org.jboss.fuse.mvnd.daemon.ClientLayout;
-import org.jboss.fuse.mvnd.daemon.ClientOutput;
-import org.jboss.fuse.mvnd.daemon.Layout;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.ClientLayout;
+import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.client.Layout;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
index 44e7cf69..da1ed88e 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/StopStatusTest.java
@@ -10,11 +10,11 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.Condition;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
-import org.jboss.fuse.mvnd.daemon.Client;
-import org.jboss.fuse.mvnd.daemon.ClientOutput;
-import org.jboss.fuse.mvnd.daemon.DaemonInfo;
-import org.jboss.fuse.mvnd.daemon.DaemonRegistry;
-import org.jboss.fuse.mvnd.daemon.DaemonState;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.client.DaemonInfo;
+import org.jboss.fuse.mvnd.client.DaemonRegistry;
+import org.jboss.fuse.mvnd.client.DaemonState;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionTest.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionTest.java
index 3526084d..ab959443 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionTest.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/VersionTest.java
@@ -6,8 +6,9 @@ import javax.inject.Inject;
import org.assertj.core.api.Assertions;
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
-import org.jboss.fuse.mvnd.daemon.Client;
-import org.jboss.fuse.mvnd.daemon.ClientOutput;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.ClientOutput;
+import org.jboss.fuse.mvnd.client.Layout;
import org.jboss.fuse.mvnd.junit.MvndTest;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -19,6 +20,9 @@ public class VersionTest {
@Inject
Client client;
+ @Inject
+ Layout layout;
+
@Test
void version() throws IOException {
final ClientOutput output = Mockito.mock(ClientOutput.class);
@@ -29,6 +33,8 @@ public class VersionTest {
Mockito.verify(output, Mockito.atLeast(1)).log(logMessage.capture());
Assertions.assertThat(logMessage.getAllValues())
- .is(new MatchInOrderAmongOthers<>("Maven Daemon " + System.getProperty("project.version")));
+ .is(new MatchInOrderAmongOthers<>(
+ "\\QMaven Daemon " + System.getProperty("project.version") + "\\E",
+ "\\QMaven home: " + layout.mavenHome() + "\\E"));
}
}
diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/MvndTestExtension.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/MvndTestExtension.java
index 2441b6b6..a0634918 100644
--- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/MvndTestExtension.java
+++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/junit/MvndTestExtension.java
@@ -12,11 +12,11 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
-import org.jboss.fuse.mvnd.daemon.Client;
-import org.jboss.fuse.mvnd.daemon.DaemonInfo;
-import org.jboss.fuse.mvnd.daemon.DaemonRegistry;
-import org.jboss.fuse.mvnd.daemon.Layout;
-import org.jboss.fuse.mvnd.daemon.ClientLayout;
+import org.jboss.fuse.mvnd.client.Client;
+import org.jboss.fuse.mvnd.client.ClientLayout;
+import org.jboss.fuse.mvnd.client.DaemonInfo;
+import org.jboss.fuse.mvnd.client.DaemonRegistry;
+import org.jboss.fuse.mvnd.client.Layout;
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
diff --git a/pom.xml b/pom.xml
index a47f8d4f..bdcee5cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,33 +15,48 @@
1.8
1.8
+
3.16.1
- 3.0.0
+ 3.0.0
1.0
- 3.12.1
- 4.12
+ 3.12.1
5.6.0
- 1.2.3
- 3.6.3
+ 1.2.3
+ 3.6.3
3.3.3
- 2.9.2
- 1.7.25
- 1.13.9
- 0.1.56
- 0.11.2
- 3.8.1
+ 1.7.25
+ 0.11.2
+
+
+ 3.8.1
1.2.0
3.0.0-M4
+ 1.13.9
+ 0.1.56
+ client
daemon
integration-tests
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+
+
+
+ org.codehaus.groovy
+ groovy
+ ${groovy.version}
+
+
org.junit
junit-bom
@@ -50,45 +65,107 @@
pom
+
+ io.takari.aether
+ takari-local-repository
+ ${takari-local-repository.version}
+
+
jakarta.inject
jakarta.inject-api
${jakarta.inject.version}
+
org.apache.maven
maven-model
- ${mavenVersion}
+ ${maven.version}
+
+ org.apache.maven
+ maven-embedder
+ ${maven.version}
+
+
+ org.apache.maven
+ apache-maven
+ tar.gz
+ bin
+ ${maven.version}
+
+
org.assertj
assertj-core
${assertj.version}
+
+
+ org.jboss.fuse.mvnd
+ mvnd-client
+ 0.1-SNAPSHOT
+
org.jboss.fuse.mvnd
mvnd-daemon
0.1-SNAPSHOT
+
- org.jboss.fuse.mvnd
- mvnd-junit5
- 0.1-SNAPSHOT
+ org.jline
+ jline-terminal
+ ${jline.version}
+
+
+ org.jline
+ jline-terminal-jansi
+ ${jline.version}
org.mockito
mockito-core
${mockito.version}
- test
-
+
+ org.slf4j
+ log4j-over-slf4j
+ ${slf4j.version}
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}
+
+
+ org.slf4j
+ jul-to-slf4j
+ ${slf4j.version}
+
+
+
+
+ io.takari.maven.plugins
+ provisio-maven-plugin
+ ${takari-provisio.version}
+
+
+ io.takari.maven.plugins
+ takari-lifecycle-plugin
+ ${takari-lifecycle.version}
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${compiler.version}
+
org.codehaus.mojo
mrm-maven-plugin