mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-11 13:39:32 +00:00
Move client classes into a separate module
This commit is contained in:
62
client/pom.xml
Normal file
62
client/pom.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jboss.fuse.mvnd</groupId>
|
||||||
|
<artifactId>mvnd</artifactId>
|
||||||
|
<version>0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>mvnd-client</artifactId>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>Maven Daemon - Client</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jline</groupId>
|
||||||
|
<artifactId>jline-terminal</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jline</groupId>
|
||||||
|
<artifactId>jline-terminal-jansi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.takari.maven.plugins</groupId>
|
||||||
|
<artifactId>takari-lifecycle-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>sisu-index</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-classes</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.nio.Buffer;
|
import java.nio.Buffer;
|
||||||
|
|
@@ -13,9 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -28,13 +26,14 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.maven.cli.CLIReportingUtils;
|
import org.fusesource.jansi.Ansi;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientOutput.TerminalOutput;
|
import org.jboss.fuse.mvnd.client.ClientOutput.TerminalOutput;
|
||||||
import org.jboss.fuse.mvnd.daemon.Message.BuildEvent;
|
import org.jboss.fuse.mvnd.client.Message.BuildEvent;
|
||||||
import org.jboss.fuse.mvnd.daemon.Message.BuildException;
|
import org.jboss.fuse.mvnd.client.Message.BuildException;
|
||||||
import org.jboss.fuse.mvnd.daemon.Message.BuildMessage;
|
import org.jboss.fuse.mvnd.client.Message.BuildMessage;
|
||||||
import org.jboss.fuse.mvnd.daemon.Message.MessageSerializer;
|
import org.jboss.fuse.mvnd.client.Message.MessageSerializer;
|
||||||
import org.jboss.fuse.mvnd.jpm.Process;
|
import org.jboss.fuse.mvnd.jpm.Process;
|
||||||
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
|
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
|
||||||
import org.jboss.fuse.mvnd.jpm.ScriptUtils;
|
import org.jboss.fuse.mvnd.jpm.ScriptUtils;
|
||||||
@@ -45,6 +44,10 @@ public class Client {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);
|
||||||
public static final String DAEMON_DEBUG = "daemon.debug";
|
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 Layout layout;
|
||||||
private final Optional<ClientLayout> clientLayout;
|
private final Optional<ClientLayout> clientLayout;
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ public class Client {
|
|||||||
final List<String> args = new ArrayList<>(argv);
|
final List<String> args = new ArrayList<>(argv);
|
||||||
|
|
||||||
// Print version if needed
|
// 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 showVersion = args.contains("-V") || args.contains("--show-version");
|
||||||
boolean debug = args.contains("-X") || args.contains("--debug");
|
boolean debug = args.contains("-X") || args.contains("--debug");
|
||||||
if (version || showVersion || debug) {
|
if (version || showVersion || debug) {
|
||||||
@@ -90,13 +93,9 @@ public class Client {
|
|||||||
try (InputStream is = Client.class.getResourceAsStream("build.properties")) {
|
try (InputStream is = Client.class.getResourceAsStream("build.properties")) {
|
||||||
props.load(is);
|
props.load(is);
|
||||||
}
|
}
|
||||||
String v = buffer().strong("Maven Daemon " + props.getProperty("version")).toString()
|
String v = Ansi.ansi().bold().a("Maven Daemon " + props.getProperty("version")).reset().toString();
|
||||||
+ System.getProperty("line.separator")
|
|
||||||
+ CLIReportingUtils.showVersion();
|
|
||||||
output.log(v);
|
output.log(v);
|
||||||
if (version) {
|
/* Do not return, rather pass -v to the server so that the client module does not need to depend on any Maven artifacts */
|
||||||
return new ClientResult<O>(argv, true, output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Path javaHome = layout.javaHome();
|
final Path javaHome = layout.javaHome();
|
||||||
@@ -207,7 +206,7 @@ public class Client {
|
|||||||
Path workingDir = layout.userDir();
|
Path workingDir = layout.userDir();
|
||||||
String command = "";
|
String command = "";
|
||||||
try {
|
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 classpath = url.substring("file:jar:".length(), url.indexOf('!'));
|
||||||
String java = ScriptUtils.isWindows() ? "bin\\java.exe" : "bin/java";
|
String java = ScriptUtils.isWindows() ? "bin\\java.exe" : "bin/java";
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
@@ -221,8 +220,9 @@ public class Client {
|
|||||||
args.add("-Dlogback.configurationFile=logback.xml");
|
args.add("-Dlogback.configurationFile=logback.xml");
|
||||||
args.add("-Ddaemon.uid=" + uid);
|
args.add("-Ddaemon.uid=" + uid);
|
||||||
args.add("-Xmx4g");
|
args.add("-Xmx4g");
|
||||||
if (System.getProperty(Server.DAEMON_IDLE_TIMEOUT) != null) {
|
final String timeout = System.getProperty(DAEMON_IDLE_TIMEOUT);
|
||||||
args.add("-D" + Server.DAEMON_IDLE_TIMEOUT + "=" + System.getProperty(Server.DAEMON_IDLE_TIMEOUT));
|
if (timeout != null) {
|
||||||
|
args.add("-D" + DAEMON_IDLE_TIMEOUT + "=" + timeout);
|
||||||
}
|
}
|
||||||
args.add("\"-Dmaven.multiModuleProjectDirectory=" + layout.multiModuleProjectDirectory().toString() + "\"");
|
args.add("\"-Dmaven.multiModuleProjectDirectory=" + layout.multiModuleProjectDirectory().toString() + "\"");
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
@@ -1,4 +1,4 @@
|
|||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
@@ -11,8 +11,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.apache.commons.cli.UnrecognizedOptionException;
|
import org.jboss.fuse.mvnd.client.Message.BuildException;
|
||||||
import org.jboss.fuse.mvnd.daemon.Message.BuildException;
|
|
||||||
import org.jline.terminal.Size;
|
import org.jline.terminal.Size;
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
import org.jline.terminal.TerminalBuilder;
|
import org.jline.terminal.TerminalBuilder;
|
||||||
@@ -109,7 +108,7 @@ public interface ClientOutput extends AutoCloseable {
|
|||||||
display.update(Collections.emptyList(), 0);
|
display.update(Collections.emptyList(), 0);
|
||||||
final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED);
|
final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED);
|
||||||
final String msg;
|
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();
|
msg = "Unable to parse command line options: " + error.getMessage();
|
||||||
} else {
|
} else {
|
||||||
msg = error.getClassName() + ": " + error.getMessage();
|
msg = error.getClassName() + ": " + error.getMessage();
|
@@ -1,4 +1,4 @@
|
|||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* 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.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
@@ -32,7 +32,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import static java.lang.Thread.sleep;
|
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 {
|
public class DaemonConnector {
|
||||||
|
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
public class DaemonException extends RuntimeException {
|
public class DaemonException extends RuntimeException {
|
||||||
|
|
@@ -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;
|
||||||
|
}
|
@@ -13,13 +13,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* 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 java.util.List;
|
||||||
|
|
||||||
import static org.jboss.fuse.mvnd.daemon.DaemonState.Busy;
|
|
||||||
import static org.jboss.fuse.mvnd.daemon.DaemonState.Idle;
|
|
||||||
|
|
||||||
public class DaemonInfo {
|
public class DaemonInfo {
|
||||||
|
|
||||||
private final String uid;
|
private final String uid;
|
@@ -14,7 +14,10 @@
|
|||||||
* limitations under the License.
|
* 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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -37,15 +40,11 @@ import java.util.concurrent.locks.Lock;
|
|||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
import sun.nio.ch.DirectBuffer;
|
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.
|
* Access to daemon registry files. Useful also for testing.
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
public interface DaemonStarter {
|
public interface DaemonStarter {
|
||||||
|
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
public enum DaemonState {
|
public enum DaemonState {
|
||||||
|
|
@@ -14,15 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information regarding when and why a daemon was stopped.
|
* Information regarding when and why a daemon was stopped.
|
||||||
*/
|
*/
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* 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.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
@@ -13,23 +13,23 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.io.UTFDataFormatException;
|
import java.io.UTFDataFormatException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.codehaus.plexus.util.ExceptionUtils;
|
|
||||||
|
|
||||||
public abstract class Message {
|
public abstract class Message {
|
||||||
|
|
||||||
final long timestamp = System.nanoTime();
|
final long timestamp = System.nanoTime();
|
||||||
|
|
||||||
long timestamp() {
|
public long timestamp() {
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,13 @@ public abstract class Message {
|
|||||||
final String stackTrace;
|
final String stackTrace;
|
||||||
|
|
||||||
public BuildException(Throwable t) {
|
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) {
|
public BuildException(String message, String className, String stackTrace) {
|
||||||
@@ -104,7 +110,7 @@ public abstract class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class BuildEvent extends Message {
|
public static class BuildEvent extends Message {
|
||||||
enum Type {
|
public enum Type {
|
||||||
BuildStarted, BuildStopped, ProjectStarted, ProjectStopped, MojoStarted, MojoStopped
|
BuildStarted, BuildStopped, ProjectStarted, ProjectStopped, MojoStarted, MojoStopped
|
||||||
}
|
}
|
||||||
final Type type;
|
final Type type;
|
||||||
@@ -286,7 +292,7 @@ public abstract class Message {
|
|||||||
final int a = byteBuf[i++] & 0xff;
|
final int a = byteBuf[i++] & 0xff;
|
||||||
if (a < 0x80) {
|
if (a < 0x80) {
|
||||||
// low bit clear
|
// low bit clear
|
||||||
chars[charIdx ++] = (char) a;
|
chars[charIdx++] = (char) a;
|
||||||
} else if (a < 0xc0) {
|
} else if (a < 0xc0) {
|
||||||
throw new UTFDataFormatException(INVALID_BYTE);
|
throw new UTFDataFormatException(INVALID_BYTE);
|
||||||
} else if (a < 0xe0) {
|
} else if (a < 0xe0) {
|
||||||
@@ -297,11 +303,11 @@ public abstract class Message {
|
|||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
final int b = byteBuf[i ++] & 0xff;
|
final int b = byteBuf[i++] & 0xff;
|
||||||
if ((b & 0xc0) != 0x80) {
|
if ((b & 0xc0) != 0x80) {
|
||||||
throw new UTFDataFormatException(INVALID_BYTE);
|
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) {
|
} else if (a < 0xf0) {
|
||||||
if (i == cnt) {
|
if (i == cnt) {
|
||||||
cnt = input.read(byteBuf, 0, Math.min(UTF_BUFS_BYTE_CNT, len - charIdx));
|
cnt = input.read(byteBuf, 0, Math.min(UTF_BUFS_BYTE_CNT, len - charIdx));
|
||||||
@@ -310,7 +316,7 @@ public abstract class Message {
|
|||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
final int b = byteBuf[i ++] & 0xff;
|
final int b = byteBuf[i++] & 0xff;
|
||||||
if ((b & 0xc0) != 0x80) {
|
if ((b & 0xc0) != 0x80) {
|
||||||
throw new UTFDataFormatException(INVALID_BYTE);
|
throw new UTFDataFormatException(INVALID_BYTE);
|
||||||
}
|
}
|
||||||
@@ -321,11 +327,11 @@ public abstract class Message {
|
|||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
final int c = byteBuf[i ++] & 0xff;
|
final int c = byteBuf[i++] & 0xff;
|
||||||
if ((c & 0xc0) != 0x80) {
|
if ((c & 0xc0) != 0x80) {
|
||||||
throw new UTFDataFormatException(INVALID_BYTE);
|
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 {
|
} else {
|
||||||
throw new UTFDataFormatException(INVALID_BYTE);
|
throw new UTFDataFormatException(INVALID_BYTE);
|
||||||
}
|
}
|
||||||
@@ -339,16 +345,16 @@ public abstract class Message {
|
|||||||
int strIdx = 0;
|
int strIdx = 0;
|
||||||
int byteIdx = 0;
|
int byteIdx = 0;
|
||||||
while (strIdx < length) {
|
while (strIdx < length) {
|
||||||
final char c = s.charAt(strIdx ++);
|
final char c = s.charAt(strIdx++);
|
||||||
if (c > 0 && c <= 0x7f) {
|
if (c > 0 && c <= 0x7f) {
|
||||||
byteBuf[byteIdx ++] = (byte) c;
|
byteBuf[byteIdx++] = (byte) c;
|
||||||
} else if (c <= 0x07ff) {
|
} else if (c <= 0x07ff) {
|
||||||
byteBuf[byteIdx ++] = (byte)(0xc0 | 0x1f & c >> 6);
|
byteBuf[byteIdx++] = (byte) (0xc0 | 0x1f & c >> 6);
|
||||||
byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c);
|
byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c);
|
||||||
} else {
|
} else {
|
||||||
byteBuf[byteIdx ++] = (byte)(0xe0 | 0x0f & c >> 12);
|
byteBuf[byteIdx++] = (byte) (0xe0 | 0x0f & c >> 12);
|
||||||
byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c >> 6);
|
byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c >> 6);
|
||||||
byteBuf[byteIdx ++] = (byte)(0x80 | 0x3f & c);
|
byteBuf[byteIdx++] = (byte) (0x80 | 0x3f & c);
|
||||||
}
|
}
|
||||||
if (byteIdx > UTF_BUFS_BYTE_CNT - 4) {
|
if (byteIdx > UTF_BUFS_BYTE_CNT - 4) {
|
||||||
output.write(byteBuf, 0, byteIdx);
|
output.write(byteBuf, 0, byteIdx);
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
package org.jboss.fuse.mvnd.client;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
@@ -22,10 +22,13 @@ import java.util.Arrays;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
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.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
public class DaemonRegistryTest {
|
public class DaemonRegistryTest {
|
||||||
|
|
@@ -14,72 +14,49 @@
|
|||||||
<name>Maven Daemon</name>
|
<name>Maven Daemon</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.fuse.mvnd</groupId>
|
||||||
|
<artifactId>mvnd-client</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-embedder</artifactId>
|
<artifactId>maven-embedder</artifactId>
|
||||||
<version>${mavenVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.takari.aether</groupId>
|
<groupId>io.takari.aether</groupId>
|
||||||
<artifactId>takari-local-repository</artifactId>
|
<artifactId>takari-local-repository</artifactId>
|
||||||
<version>${takariLocalRepositoryVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Logging -->
|
<!-- Logging -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>${logbackVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>log4j-over-slf4j</artifactId>
|
<artifactId>log4j-over-slf4j</artifactId>
|
||||||
<version>${slf4jVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<version>${slf4jVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>jul-to-slf4j</artifactId>
|
<artifactId>jul-to-slf4j</artifactId>
|
||||||
<version>${slf4jVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jline</groupId>
|
<groupId>org.jline</groupId>
|
||||||
<artifactId>jline-terminal</artifactId>
|
<artifactId>jline-terminal</artifactId>
|
||||||
<version>${jlineVersion}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jline</groupId>
|
|
||||||
<artifactId>jline-terminal-jansi</artifactId>
|
|
||||||
<version>${jlineVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
<groupId>org.codehaus.groovy</groupId>
|
||||||
<artifactId>groovy</artifactId>
|
<artifactId>groovy</artifactId>
|
||||||
<version>${groovyVersion}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<version>${junitVersion}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.takari.maven.plugins</groupId>
|
|
||||||
<artifactId>takari-plugin-testing</artifactId>
|
|
||||||
<version>${pluginTestingVersion}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.takari.maven.plugins</groupId>
|
|
||||||
<artifactId>takari-plugin-integration-testing</artifactId>
|
|
||||||
<version>${pluginTestingVersion}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@@ -95,7 +72,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.takari.maven.plugins</groupId>
|
<groupId>io.takari.maven.plugins</groupId>
|
||||||
<artifactId>takari-lifecycle-plugin</artifactId>
|
<artifactId>takari-lifecycle-plugin</artifactId>
|
||||||
<version>${takariLifecycleVersion}</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
@@ -105,19 +81,9 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>${mavenCompilerPluginVersion}</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.takari.maven.plugins</groupId>
|
<groupId>io.takari.maven.plugins</groupId>
|
||||||
<artifactId>provisio-maven-plugin</artifactId>
|
<artifactId>provisio-maven-plugin</artifactId>
|
||||||
<version>${takariProvisioVersion}</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>maven-distro</id>
|
<id>maven-distro</id>
|
||||||
@@ -131,22 +97,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>integration-test</id>
|
|
||||||
<phase>integration-test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<includes>**/*IT.java</includes>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ fi
|
|||||||
|
|
||||||
DAEMON_JAR=`echo "${MVND_HOME}"/lib/ext/*.jar "${MVND_HOME}"/lib/*.jar`
|
DAEMON_JAR=`echo "${MVND_HOME}"/lib/ext/*.jar "${MVND_HOME}"/lib/*.jar`
|
||||||
DAEMON_JAR=$(echo $DAEMON_JAR | sed -e 's/ /:/g')
|
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
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
|
@@ -89,6 +89,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
|||||||
import org.codehaus.plexus.logging.LoggerManager;
|
import org.codehaus.plexus.logging.LoggerManager;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.eclipse.aether.transfer.TransferListener;
|
import org.eclipse.aether.transfer.TransferListener;
|
||||||
|
import org.jboss.fuse.mvnd.logging.smart.AbstractLoggingSpy;
|
||||||
import org.slf4j.ILoggerFactory;
|
import org.slf4j.ILoggerFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -165,8 +166,8 @@ public class DaemonMavenCli
|
|||||||
cli(cliRequest);
|
cli(cliRequest);
|
||||||
properties(cliRequest);
|
properties(cliRequest);
|
||||||
logging(cliRequest);
|
logging(cliRequest);
|
||||||
version( cliRequest );
|
|
||||||
configure(cliRequest);
|
configure(cliRequest);
|
||||||
|
version( cliRequest );
|
||||||
toolchains(cliRequest);
|
toolchains(cliRequest);
|
||||||
populateRequest( cliRequest );
|
populateRequest( cliRequest );
|
||||||
encryption( cliRequest );
|
encryption( cliRequest );
|
||||||
@@ -274,11 +275,6 @@ public class DaemonMavenCli
|
|||||||
throw new ExitException( 0 );
|
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 )
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,10 +23,15 @@ import java.util.Objects;
|
|||||||
import java.util.function.ToLongFunction;
|
import java.util.function.ToLongFunction;
|
||||||
import java.util.stream.Collectors;
|
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.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 {
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.daemon;
|
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.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.InetSocketAddress;
|
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.CliRequest;
|
||||||
import org.apache.maven.cli.CliRequestBuilder;
|
import org.apache.maven.cli.CliRequestBuilder;
|
||||||
import org.apache.maven.cli.DaemonMavenCli;
|
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.DaemonExpirationResult;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStatus;
|
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonExpiration.DaemonExpirationStrategy;
|
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.jboss.fuse.mvnd.logging.smart.AbstractLoggingSpy;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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 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);
|
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));
|
socket = ServerSocketChannel.open().bind(new InetSocketAddress(0));
|
||||||
|
|
||||||
int idleTimeout;
|
int idleTimeout;
|
||||||
if (System.getProperty(DAEMON_IDLE_TIMEOUT) != null) {
|
if (System.getProperty(Client.DAEMON_IDLE_TIMEOUT) != null) {
|
||||||
idleTimeout = Integer.parseInt(System.getProperty(DAEMON_IDLE_TIMEOUT));
|
idleTimeout = Integer.parseInt(System.getProperty(Client.DAEMON_IDLE_TIMEOUT));
|
||||||
} else {
|
} else {
|
||||||
idleTimeout = DEFAULT_IDLE_TIMEOUT;
|
idleTimeout = Client.DEFAULT_IDLE_TIMEOUT;
|
||||||
}
|
}
|
||||||
executor = Executors.newScheduledThreadPool(1);
|
executor = Executors.newScheduledThreadPool(1);
|
||||||
strategy = DaemonExpiration.master();
|
strategy = DaemonExpiration.master();
|
||||||
@@ -334,7 +337,7 @@ public class Server implements AutoCloseable, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelNow() {
|
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.");
|
// LOGGER.debug("Cancel requested: will wait for daemon to become idle.");
|
||||||
// try {
|
// try {
|
||||||
@@ -382,9 +385,9 @@ public class Server implements AutoCloseable, Runnable {
|
|||||||
try {
|
try {
|
||||||
LOGGER.info("Executing request");
|
LOGGER.info("Executing request");
|
||||||
CliRequest req = new CliRequestBuilder()
|
CliRequest req = new CliRequestBuilder()
|
||||||
.arguments(buildRequest.args)
|
.arguments(buildRequest.getArgs())
|
||||||
.workingDirectory(Paths.get(buildRequest.workingDir))
|
.workingDirectory(Paths.get(buildRequest.getWorkingDir()))
|
||||||
.projectDirectory(Paths.get(buildRequest.projectDir))
|
.projectDirectory(Paths.get(buildRequest.getProjectDir()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
PriorityBlockingQueue<Message> queue = new PriorityBlockingQueue<Message>(64,
|
PriorityBlockingQueue<Message> queue = new PriorityBlockingQueue<Message>(64,
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<assembly>
|
<assembly>
|
||||||
|
|
||||||
<artifactSet to="/">
|
<artifactSet to="/">
|
||||||
<artifact id="org.apache.maven:apache-maven:tar.gz:bin:${mavenVersion}">
|
<artifact id="org.apache.maven:apache-maven:tar.gz:bin">
|
||||||
<unpack useRoot="false"
|
<unpack useRoot="false"
|
||||||
excludes="lib/slf4j*,conf/logging/*,lib/maven-slf4j-provider*"/>
|
excludes="lib/slf4j*,conf/logging/*,lib/maven-slf4j-provider*"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
|
|
||||||
<artifactSet to="lib">
|
<artifactSet to="lib">
|
||||||
<artifact id="org.apache.maven:maven-embedder:${mavenVersion}"/>
|
<artifact id="org.apache.maven:maven-embedder"/>
|
||||||
<artifactSet to="ext" ref="runtime.classpath"/>
|
<artifactSet to="ext" ref="runtime.classpath"/>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<directory path="${basedir}/src/main/distro"/>
|
<directory path="${basedir}/src/main/distro"/>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
|
|
||||||
<archive name="maven-distro-${mavenVersion}-${project.version}.tar.gz"
|
<archive name="mvnd-dist-${maven.version}-${project.version}.tar.gz"
|
||||||
executable="**/bin/mvn,**/bin/mvnd,**/bin/mvnDebug,**/bin/mvnyjp"/>
|
executable="**/bin/mvn,**/bin/mvnd,**/bin/mvnDebug,**/bin/mvnyjp"/>
|
||||||
|
|
||||||
</assembly>
|
</assembly>
|
||||||
|
@@ -5,11 +5,11 @@ import java.util.Collection;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
abstract class AbstractSmartBuilderTest {
|
abstract class AbstractSmartBuilderTest {
|
||||||
protected void assertProjects(Collection<MavenProject> actual, MavenProject... expected) {
|
protected void assertProjects(Collection<MavenProject> actual, MavenProject... expected) {
|
||||||
Assert.assertEquals(new HashSet<MavenProject>(Arrays.asList(expected)), new HashSet<>(actual));
|
Assertions.assertEquals(new HashSet<MavenProject>(Arrays.asList(expected)), new HashSet<>(actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MavenProject newProject(String artifactId) {
|
protected MavenProject newProject(String artifactId) {
|
||||||
|
@@ -20,8 +20,8 @@ import java.util.HashSet;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class DependencyGraphTest extends AbstractSmartBuilderTest {
|
public class DependencyGraphTest extends AbstractSmartBuilderTest {
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class DependencyGraphTest extends AbstractSmartBuilderTest {
|
|||||||
TestProjectDependencyGraph graph = new TestProjectDependencyGraph(a, b, c);
|
TestProjectDependencyGraph graph = new TestProjectDependencyGraph(a, b, c);
|
||||||
graph.addDependency(b, a);
|
graph.addDependency(b, a);
|
||||||
DependencyGraph<MavenProject> dp = DependencyGraph.fromMaven(graph, "a before c");
|
DependencyGraph<MavenProject> 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()));
|
dp.getDownstreamProjects(a).collect(Collectors.toSet()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,8 +7,8 @@ import java.util.Queue;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
|
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@ public class ProjectComparatorTest extends AbstractSmartBuilderTest {
|
|||||||
queue.add(b);
|
queue.add(b);
|
||||||
queue.add(c);
|
queue.add(c);
|
||||||
|
|
||||||
Assert.assertEquals(a, queue.poll());
|
Assertions.assertEquals(a, queue.poll());
|
||||||
Assert.assertEquals(c, queue.poll());
|
Assertions.assertEquals(c, queue.poll());
|
||||||
Assert.assertEquals(b, queue.poll());
|
Assertions.assertEquals(b, queue.poll());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -52,9 +52,9 @@ public class ProjectComparatorTest extends AbstractSmartBuilderTest {
|
|||||||
queue.add(b);
|
queue.add(b);
|
||||||
queue.add(c);
|
queue.add(c);
|
||||||
|
|
||||||
Assert.assertEquals(c, queue.poll());
|
Assertions.assertEquals(c, queue.poll());
|
||||||
Assert.assertEquals(a, queue.poll());
|
Assertions.assertEquals(a, queue.poll());
|
||||||
Assert.assertEquals(b, queue.poll());
|
Assertions.assertEquals(b, queue.poll());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -11,8 +11,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
import com.google.common.util.concurrent.Monitor;
|
import com.google.common.util.concurrent.Monitor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.jboss.fuse.mvnd.builder.ProjectExecutorService.ProjectRunnable;
|
import org.jboss.fuse.mvnd.builder.ProjectExecutorService.ProjectRunnable;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
|
import static org.jboss.fuse.mvnd.builder.ProjectComparator.id;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public class ProjectExecutorServiceTest extends AbstractSmartBuilderTest {
|
|||||||
executor.resume();
|
executor.resume();
|
||||||
executor.awaitShutdown();
|
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)
|
// copy&paste from ThreadPoolExecutor javadoc (use of Guava is a nice touch there)
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package org.jboss.fuse.mvnd.builder;
|
package org.jboss.fuse.mvnd.builder;
|
||||||
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
|
public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
|
||||||
|
|
||||||
@@ -16,10 +16,10 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
|
|||||||
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
||||||
|
|
||||||
assertProjects(schl.getRootProjects(), a, c);
|
assertProjects(schl.getRootProjects(), a, c);
|
||||||
Assert.assertFalse(schl.isEmpty());
|
Assertions.assertFalse(schl.isEmpty());
|
||||||
|
|
||||||
assertProjects(schl.onProjectFinish(a), b);
|
assertProjects(schl.onProjectFinish(a), b);
|
||||||
Assert.assertTrue(schl.isEmpty());
|
Assertions.assertTrue(schl.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -31,7 +31,7 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
|
|||||||
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
||||||
|
|
||||||
assertProjects(schl.getRootProjects(), a, b, c);
|
assertProjects(schl.getRootProjects(), a, b, c);
|
||||||
Assert.assertTrue(schl.isEmpty());
|
Assertions.assertTrue(schl.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -45,12 +45,12 @@ public class ReactorBuildQueueTest extends AbstractSmartBuilderTest {
|
|||||||
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
ReactorBuildQueue schl = new ReactorBuildQueue(graph.getSortedProjects(), dp);
|
||||||
|
|
||||||
assertProjects(schl.getRootProjects(), a, c);
|
assertProjects(schl.getRootProjects(), a, c);
|
||||||
Assert.assertFalse(schl.isEmpty());
|
Assertions.assertFalse(schl.isEmpty());
|
||||||
|
|
||||||
assertProjects(schl.onProjectFinish(a), new MavenProject[0]);
|
assertProjects(schl.onProjectFinish(a), new MavenProject[0]);
|
||||||
Assert.assertFalse(schl.isEmpty());
|
Assertions.assertFalse(schl.isEmpty());
|
||||||
|
|
||||||
assertProjects(schl.onProjectFinish(c), b);
|
assertProjects(schl.onProjectFinish(c), b);
|
||||||
Assert.assertTrue(schl.isEmpty());
|
Assertions.assertTrue(schl.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ import com.google.common.collect.ArrayListMultimap;
|
|||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
public class TestProjectDependencyGraph implements ProjectDependencyGraph {
|
public class TestProjectDependencyGraph implements ProjectDependencyGraph {
|
||||||
|
|
||||||
@@ -36,13 +36,13 @@ public class TestProjectDependencyGraph implements ProjectDependencyGraph {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive) {
|
public List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive) {
|
||||||
Assert.assertFalse("not implemented", transitive);
|
Assertions.assertFalse(transitive, "not implemented");
|
||||||
return downstream.get(project);
|
return downstream.get(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive) {
|
public List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive) {
|
||||||
Assert.assertFalse("not implemented", transitive);
|
Assertions.assertFalse(transitive, "not implemented");
|
||||||
return upstream.get(project);
|
return upstream.get(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,10 +10,10 @@ import javax.inject.Inject;
|
|||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.jboss.fuse.mvnd.assertj.EqualsInOrderAmongOthers;
|
import org.jboss.fuse.mvnd.assertj.EqualsInOrderAmongOthers;
|
||||||
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
||||||
import org.jboss.fuse.mvnd.daemon.Client;
|
import org.jboss.fuse.mvnd.client.Client;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientLayout;
|
import org.jboss.fuse.mvnd.client.ClientLayout;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientOutput;
|
import org.jboss.fuse.mvnd.client.ClientOutput;
|
||||||
import org.jboss.fuse.mvnd.daemon.Layout;
|
import org.jboss.fuse.mvnd.client.Layout;
|
||||||
import org.jboss.fuse.mvnd.junit.MvndTest;
|
import org.jboss.fuse.mvnd.junit.MvndTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
@@ -9,10 +9,10 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
||||||
import org.jboss.fuse.mvnd.daemon.Client;
|
import org.jboss.fuse.mvnd.client.Client;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientLayout;
|
import org.jboss.fuse.mvnd.client.ClientLayout;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientOutput;
|
import org.jboss.fuse.mvnd.client.ClientOutput;
|
||||||
import org.jboss.fuse.mvnd.daemon.Layout;
|
import org.jboss.fuse.mvnd.client.Layout;
|
||||||
import org.jboss.fuse.mvnd.junit.MvndTest;
|
import org.jboss.fuse.mvnd.junit.MvndTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
@@ -10,11 +10,11 @@ import javax.inject.Inject;
|
|||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.assertj.core.api.Condition;
|
import org.assertj.core.api.Condition;
|
||||||
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
||||||
import org.jboss.fuse.mvnd.daemon.Client;
|
import org.jboss.fuse.mvnd.client.Client;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientOutput;
|
import org.jboss.fuse.mvnd.client.ClientOutput;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonInfo;
|
import org.jboss.fuse.mvnd.client.DaemonInfo;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonRegistry;
|
import org.jboss.fuse.mvnd.client.DaemonRegistry;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonState;
|
import org.jboss.fuse.mvnd.client.DaemonState;
|
||||||
import org.jboss.fuse.mvnd.junit.MvndTest;
|
import org.jboss.fuse.mvnd.junit.MvndTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
@@ -6,8 +6,9 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
import org.jboss.fuse.mvnd.assertj.MatchInOrderAmongOthers;
|
||||||
import org.jboss.fuse.mvnd.daemon.Client;
|
import org.jboss.fuse.mvnd.client.Client;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientOutput;
|
import org.jboss.fuse.mvnd.client.ClientOutput;
|
||||||
|
import org.jboss.fuse.mvnd.client.Layout;
|
||||||
import org.jboss.fuse.mvnd.junit.MvndTest;
|
import org.jboss.fuse.mvnd.junit.MvndTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
@@ -19,6 +20,9 @@ public class VersionTest {
|
|||||||
@Inject
|
@Inject
|
||||||
Client client;
|
Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Layout layout;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void version() throws IOException {
|
void version() throws IOException {
|
||||||
final ClientOutput output = Mockito.mock(ClientOutput.class);
|
final ClientOutput output = Mockito.mock(ClientOutput.class);
|
||||||
@@ -29,6 +33,8 @@ public class VersionTest {
|
|||||||
Mockito.verify(output, Mockito.atLeast(1)).log(logMessage.capture());
|
Mockito.verify(output, Mockito.atLeast(1)).log(logMessage.capture());
|
||||||
|
|
||||||
Assertions.assertThat(logMessage.getAllValues())
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,11 +12,11 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.jboss.fuse.mvnd.daemon.Client;
|
import org.jboss.fuse.mvnd.client.Client;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonInfo;
|
import org.jboss.fuse.mvnd.client.ClientLayout;
|
||||||
import org.jboss.fuse.mvnd.daemon.DaemonRegistry;
|
import org.jboss.fuse.mvnd.client.DaemonInfo;
|
||||||
import org.jboss.fuse.mvnd.daemon.Layout;
|
import org.jboss.fuse.mvnd.client.DaemonRegistry;
|
||||||
import org.jboss.fuse.mvnd.daemon.ClientLayout;
|
import org.jboss.fuse.mvnd.client.Layout;
|
||||||
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
|
import org.jboss.fuse.mvnd.jpm.ProcessImpl;
|
||||||
import org.junit.jupiter.api.extension.AfterAllCallback;
|
import org.junit.jupiter.api.extension.AfterAllCallback;
|
||||||
import org.junit.jupiter.api.extension.BeforeAllCallback;
|
import org.junit.jupiter.api.extension.BeforeAllCallback;
|
||||||
|
111
pom.xml
111
pom.xml
@@ -15,33 +15,48 @@
|
|||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
|
||||||
|
<!-- dependency versions a..z -->
|
||||||
<assertj.version>3.16.1</assertj.version>
|
<assertj.version>3.16.1</assertj.version>
|
||||||
<groovyVersion>3.0.0</groovyVersion>
|
<groovy.version>3.0.0</groovy.version>
|
||||||
<jakarta.inject.version>1.0</jakarta.inject.version>
|
<jakarta.inject.version>1.0</jakarta.inject.version>
|
||||||
<jlineVersion>3.12.1</jlineVersion>
|
<jline.version>3.12.1</jline.version>
|
||||||
<junitVersion>4.12</junitVersion>
|
|
||||||
<junit.jupiter.version>5.6.0</junit.jupiter.version>
|
<junit.jupiter.version>5.6.0</junit.jupiter.version>
|
||||||
<logbackVersion>1.2.3</logbackVersion>
|
<logback.version>1.2.3</logback.version>
|
||||||
<mavenVersion>3.6.3</mavenVersion>
|
<maven.version>3.6.3</maven.version>
|
||||||
<mockito.version>3.3.3</mockito.version>
|
<mockito.version>3.3.3</mockito.version>
|
||||||
<pluginTestingVersion>2.9.2</pluginTestingVersion>
|
<slf4j.version>1.7.25</slf4j.version>
|
||||||
<slf4jVersion>1.7.25</slf4jVersion>
|
<takari-local-repository.version>0.11.2</takari-local-repository.version>
|
||||||
<takariLifecycleVersion>1.13.9</takariLifecycleVersion>
|
|
||||||
<takariProvisioVersion>0.1.56</takariProvisioVersion>
|
<!-- plugin versions a..z -->
|
||||||
<takariLocalRepositoryVersion>0.11.2</takariLocalRepositoryVersion>
|
<compiler.version>3.8.1</compiler.version>
|
||||||
<mavenCompilerPluginVersion>3.8.1</mavenCompilerPluginVersion>
|
|
||||||
<mrm.version>1.2.0</mrm.version>
|
<mrm.version>1.2.0</mrm.version>
|
||||||
<surefire.version>3.0.0-M4</surefire.version>
|
<surefire.version>3.0.0-M4</surefire.version>
|
||||||
|
<takari-lifecycle.version>1.13.9</takari-lifecycle.version>
|
||||||
|
<takari-provisio.version>0.1.56</takari-provisio.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>client</module>
|
||||||
<module>daemon</module>
|
<module>daemon</module>
|
||||||
<module>integration-tests</module>
|
<module>integration-tests</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.groovy</groupId>
|
||||||
|
<artifactId>groovy</artifactId>
|
||||||
|
<version>${groovy.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit</groupId>
|
<groupId>org.junit</groupId>
|
||||||
<artifactId>junit-bom</artifactId>
|
<artifactId>junit-bom</artifactId>
|
||||||
@@ -50,45 +65,107 @@
|
|||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.takari.aether</groupId>
|
||||||
|
<artifactId>takari-local-repository</artifactId>
|
||||||
|
<version>${takari-local-repository.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.inject</groupId>
|
<groupId>jakarta.inject</groupId>
|
||||||
<artifactId>jakarta.inject-api</artifactId>
|
<artifactId>jakarta.inject-api</artifactId>
|
||||||
<version>${jakarta.inject.version}</version>
|
<version>${jakarta.inject.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-model</artifactId>
|
<artifactId>maven-model</artifactId>
|
||||||
<version>${mavenVersion}</version>
|
<version>${maven.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-embedder</artifactId>
|
||||||
|
<version>${maven.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>apache-maven</artifactId>
|
||||||
|
<type>tar.gz</type>
|
||||||
|
<classifier>bin</classifier>
|
||||||
|
<version>${maven.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
<version>${assertj.version}</version>
|
<version>${assertj.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.fuse.mvnd</groupId>
|
||||||
|
<artifactId>mvnd-client</artifactId>
|
||||||
|
<version>0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.fuse.mvnd</groupId>
|
<groupId>org.jboss.fuse.mvnd</groupId>
|
||||||
<artifactId>mvnd-daemon</artifactId>
|
<artifactId>mvnd-daemon</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.fuse.mvnd</groupId>
|
<groupId>org.jline</groupId>
|
||||||
<artifactId>mvnd-junit5</artifactId>
|
<artifactId>jline-terminal</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>${jline.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jline</groupId>
|
||||||
|
<artifactId>jline-terminal-jansi</artifactId>
|
||||||
|
<version>${jline.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito.version}</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>log4j-over-slf4j</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jul-to-slf4j</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.takari.maven.plugins</groupId>
|
||||||
|
<artifactId>provisio-maven-plugin</artifactId>
|
||||||
|
<version>${takari-provisio.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.takari.maven.plugins</groupId>
|
||||||
|
<artifactId>takari-lifecycle-plugin</artifactId>
|
||||||
|
<version>${takari-lifecycle.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${compiler.version}</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>mrm-maven-plugin</artifactId>
|
<artifactId>mrm-maven-plugin</artifactId>
|
||||||
|
Reference in New Issue
Block a user