diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java index 7981f16ff..a08d72e98 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/DefaultClient.java @@ -41,6 +41,7 @@ import org.mvndaemon.mvnd.common.Environment; import org.mvndaemon.mvnd.common.Message; import org.mvndaemon.mvnd.common.Message.BuildException; +import org.mvndaemon.mvnd.common.Message.BuildFinished; import org.mvndaemon.mvnd.common.OsUtils; import org.mvndaemon.mvnd.common.TimeUtils; import org.mvndaemon.mvnd.common.logging.ClientOutput; @@ -79,16 +80,20 @@ public static void main(String[] argv) throws Exception { } DaemonParameters parameters = new DaemonParameters(); + int exitCode = 0; try (TerminalOutput output = new TerminalOutput(batchMode || parameters.noBuffering(), parameters.rollingWindowSize(), logFile)) { try { - new DefaultClient(parameters).execute(output, args); + final ExecutionResult result = new DefaultClient(parameters).execute(output, args); + exitCode = result.getExitCode(); } catch (DaemonException.InterruptedException e) { final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED); String str = new AttributedString(System.lineSeparator() + "Canceled by user", s).toAnsi(); output.accept(Message.display(str)); + exitCode = 130; } } + System.exit(exitCode); } public DefaultClient(DaemonParameters parameters) { @@ -176,7 +181,7 @@ public ExecutionResult execute(ClientOutput output, List argv) { d.getJavaHome()))); } } - return new DefaultResult(argv, null); + return DefaultResult.success(argv); } boolean stop = args.remove("--stop"); if (stop) { @@ -193,13 +198,13 @@ public ExecutionResult execute(ClientOutput output, List argv) { } } } - return new DefaultResult(argv, null); + return DefaultResult.success(argv); } boolean purge = args.remove("--purge"); if (purge) { String result = purgeLogs(); output.accept(Message.display(result != null ? result : "Nothing to purge")); - return new DefaultResult(argv, null); + return DefaultResult.success(argv); } if (args.stream().noneMatch(arg -> arg.startsWith("-T") || arg.equals("--threads"))) { @@ -250,13 +255,14 @@ public ExecutionResult execute(ClientOutput output, List argv) { switch (m.getType()) { case Message.CANCEL_BUILD: return new DefaultResult(argv, - new InterruptedException("The build was canceled")); + new InterruptedException("The build was canceled"), 130); case Message.BUILD_EXCEPTION: final BuildException e = (BuildException) m; return new DefaultResult(argv, - new Exception(e.getClassName() + ": " + e.getMessage() + "\n" + e.getStackTrace())); - case Message.BUILD_STOPPED: - return new DefaultResult(argv, null); + new Exception(e.getClassName() + ": " + e.getMessage() + "\n" + e.getStackTrace()), + 1); + case Message.BUILD_FINISHED: + return new DefaultResult(argv, null, ((BuildFinished) m).getExitCode()); } } } @@ -344,41 +350,50 @@ private static class DefaultResult implements ExecutionResult { private final Exception exception; private final List args; + private final int exitCode; - private DefaultResult(List args, Exception exception) { + public static DefaultResult success(List args) { + return new DefaultResult(args, null, 0); + } + + private DefaultResult(List args, Exception exception, int exitCode) { super(); this.args = args; this.exception = exception; + this.exitCode = exitCode; } @Override public ExecutionResult assertSuccess() { if (exception != null) { - throw new AssertionError(appendCommand(new StringBuilder("Build failed: ")).toString(), exception); + throw new AssertionError(ExecutionResult.appendCommand(new StringBuilder("Build failed: "), args).toString(), exception); + } + if (exitCode != 0) { + throw new AssertionError( + ExecutionResult.appendCommand(new StringBuilder("Build exited with non-zero exit code " + exitCode + ": "), args).toString(), + exception); } return this; } @Override public ExecutionResult assertFailure() { - if (exception == null) { - throw new AssertionError(appendCommand(new StringBuilder("Build did not fail: "))); + if (exception == null && exitCode == 0) { + throw new AssertionError(ExecutionResult.appendCommand(new StringBuilder("Build did not fail: "), args)); } return this; } + @Override + public int getExitCode() { + return exitCode; + } + @Override public boolean isSuccess() { return exception == null; } - StringBuilder appendCommand(StringBuilder sb) { - sb.append("mvnd"); - for (String arg : args) { - sb.append(" \"").append(arg).append('"'); - } - return sb; - } } } diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/ExecutionResult.java b/client/src/main/java/org/mvndaemon/mvnd/client/ExecutionResult.java index 60b657636..0c87f0112 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/ExecutionResult.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/ExecutionResult.java @@ -15,6 +15,8 @@ */ package org.mvndaemon.mvnd.client; +import java.util.List; + /** * A result of a {@code mvnd} build. */ @@ -26,4 +28,14 @@ public interface ExecutionResult { ExecutionResult assertSuccess(); + int getExitCode(); + + public static StringBuilder appendCommand(StringBuilder sb, List args) { + sb.append("mvnd"); + for (String arg : args) { + sb.append(" \"").append(arg).append('"'); + } + return sb; + } + } diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java index 9784b5da8..f2eacc6f8 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java @@ -31,7 +31,7 @@ public abstract class Message { public static final int BUILD_REQUEST = 0; public static final int BUILD_STARTED = 1; - public static final int BUILD_STOPPED = 2; + public static final int BUILD_FINISHED = 2; public static final int PROJECT_STARTED = 3; public static final int PROJECT_STOPPED = 4; public static final int MOJO_STARTED = 5; @@ -49,7 +49,6 @@ public abstract class Message { public static final BareMessage KEEP_ALIVE_SINGLETON = new BareMessage(KEEP_ALIVE); public static final BareMessage STOP_SINGLETON = new BareMessage(STOP); - public static final BareMessage BUILD_STOPPED_SINGLETON = new BareMessage(BUILD_STOPPED); public static final BareMessage CANCEL_BUILD_SINGLETON = new BareMessage(CANCEL_BUILD); final int type; @@ -68,8 +67,8 @@ public static Message read(DataInputStream input) throws IOException { return BuildRequest.read(input); case BUILD_STARTED: return BuildStarted.read(input); - case BUILD_STOPPED: - return BareMessage.BUILD_STOPPED_SINGLETON; + case BUILD_FINISHED: + return BuildFinished.read(input); case PROJECT_STARTED: case PROJECT_STOPPED: case MOJO_STARTED: @@ -300,6 +299,34 @@ public void write(DataOutputStream output) throws IOException { } } + public static class BuildFinished extends Message { + final int exitCode; + + public static Message read(DataInputStream input) throws IOException { + return new BuildFinished(input.readInt()); + } + + public BuildFinished(int exitCode) { + super(BUILD_FINISHED); + this.exitCode = exitCode; + } + + @Override + public String toString() { + return "BuildRequest{exitCode=" + exitCode + '}'; + } + + @Override + public void write(DataOutputStream output) throws IOException { + super.write(output); + output.writeInt(exitCode); + } + + public int getExitCode() { + return exitCode; + } + } + public static class BuildException extends Message { final String message; final String className; @@ -474,7 +501,7 @@ public String toString() { switch (type) { case KEEP_ALIVE: return "KeepAlive"; - case BUILD_STOPPED: + case BUILD_FINISHED: return "BuildStopped"; case STOP: return "Stop"; diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java index 5f1880fc7..e4438b48d 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java @@ -229,7 +229,7 @@ private boolean doAccept(Message entry) { this.buildStatus = ((StringMessage) entry).getMessage(); break; } - case Message.BUILD_STOPPED: { + case Message.BUILD_FINISHED: { projects.values().stream().flatMap(p -> p.log.stream()).forEach(log); clearDisplay(); try { diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java index c5732800e..f17e25503 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java @@ -529,13 +529,13 @@ public T request(Message request, Class responseType, Pre } } }); - cli.main( + int exitCode = cli.main( buildRequest.getArgs(), buildRequest.getWorkingDir(), buildRequest.getProjectDir(), buildRequest.getEnv()); LOGGER.info("Build finished, finishing message dispatch"); - loggingSpy.finish(); + loggingSpy.finish(exitCode); } catch (Throwable t) { LOGGER.error("Error while building project", t); loggingSpy.fail(t); @@ -574,7 +574,7 @@ int getClassOrder(Message m) { return 51; case Message.PROJECT_STOPPED: return 95; - case Message.BUILD_STOPPED: + case Message.BUILD_FINISHED: return 96; case Message.BUILD_EXCEPTION: return 97; @@ -636,8 +636,8 @@ public DaemonLoggingSpy(BlockingQueue queue) { this.queue = queue; } - public void finish() throws Exception { - queue.add(Message.BUILD_STOPPED_SINGLETON); + public void finish(int exitCode) throws Exception { + queue.add(new Message.BuildFinished(exitCode)); queue.add(Message.STOP_SINGLETON); } diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleNativeIT.java new file mode 100644 index 000000000..d736f19df --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleNativeIT.java @@ -0,0 +1,91 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.it; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.stream.Stream; +import javax.inject.Inject; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mvndaemon.mvnd.assertj.TestClientOutput; +import org.mvndaemon.mvnd.client.Client; +import org.mvndaemon.mvnd.common.DaemonInfo; +import org.mvndaemon.mvnd.junit.ClientFactory; +import org.mvndaemon.mvnd.junit.MvndNativeTest; +import org.mvndaemon.mvnd.junit.TestParameters; +import org.mvndaemon.mvnd.junit.TestRegistry; + +@MvndNativeTest(projectDir = "src/test/projects/new-managed-module") +public class NewManagedModuleNativeIT { + + @Inject + TestParameters parameters; + + @Inject + TestRegistry registry; + + @Inject + ClientFactory clientFactory; + + @Test + void upgrade() throws IOException, InterruptedException { + Assertions.assertThat(registry.getAll().size()).isEqualTo(0); + + /* Build the initial state of the test project */ + final Path parentDir = parameters.getTestDir().resolve("project/parent"); + final Client cl = clientFactory.newClient(parameters.cd(parentDir)); + { + final TestClientOutput output = new TestClientOutput(); + cl.execute(output, "clean", "install", "-e", "-B", "-ntp").assertSuccess(); + } + Assertions.assertThat(registry.getAll().size()).isEqualTo(1); + + final DaemonInfo d = registry.getAll().get(0); + /* Wait, till the instance becomes idle */ + registry.awaitIdle(d.getUid()); + + /* Do the changes */ + final Path srcDir = parentDir.resolve("../changes").normalize(); + try (Stream files = Files.walk(srcDir)) { + files.forEach(source -> { + final Path relPath = srcDir.relativize(source); + final Path dest = parentDir.resolve(relPath); + try { + if (Files.isDirectory(source)) { + Files.createDirectories(dest); + } else { + Files.createDirectories(dest.getParent()); + Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + }); + } + + /* Build again */ + { + final TestClientOutput output = new TestClientOutput(); + cl.execute(output, "clean", "install", "-e", "-B", "-ntp") + .assertFailure(); // Switch back to assertSuccess() once https://github.com/mvndaemon/mvnd/issues/218 is fixed + } + Assertions.assertThat(registry.getAll().size()).isEqualTo(1); + + } +} diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleTest.java new file mode 100644 index 000000000..4848589f5 --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/NewManagedModuleTest.java @@ -0,0 +1,23 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.it; + +import org.mvndaemon.mvnd.junit.MvndTest; + +@MvndTest(projectDir = "src/test/projects/new-managed-module") +public class NewManagedModuleTest extends NewManagedModuleNativeIT { + +} diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/UpgradesInBomNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/UpgradesInBomNativeIT.java index 3dc3c2e8e..bc32a89ed 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/UpgradesInBomNativeIT.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/UpgradesInBomNativeIT.java @@ -76,7 +76,8 @@ void upgrade() throws IOException, InterruptedException { TestUtils.replace(useHelloPath, "new Hello().sayHello()", "new Hello().sayWisdom()"); { final TestClientOutput output = new TestClientOutput(); - cl.execute(output, "clean", "install", "-e").assertSuccess(); + cl.execute(output, "clean", "install", "-e") + .assertFailure(); // Switch back to assertSuccess() once https://github.com/mvndaemon/mvnd/issues/218 is fixed } Assertions.assertThat(registry.getAll().size()).isEqualTo(1); diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java new file mode 100644 index 000000000..839be95b4 --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/JvmTestClient.java @@ -0,0 +1,94 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.junit; + +import java.util.List; +import org.mvndaemon.mvnd.assertj.TestClientOutput; +import org.mvndaemon.mvnd.client.DaemonParameters; +import org.mvndaemon.mvnd.client.DefaultClient; +import org.mvndaemon.mvnd.client.ExecutionResult; +import org.mvndaemon.mvnd.common.logging.ClientOutput; + +public class JvmTestClient extends DefaultClient { + + public JvmTestClient(DaemonParameters parameters) { + super(parameters); + } + + @Override + public ExecutionResult execute(ClientOutput output, List argv) { + final ExecutionResult delegate = super.execute(output, argv); + if (output instanceof TestClientOutput) { + return new JvmTestResult(delegate, ((TestClientOutput) output).messagesToString()); + } + return delegate; + } + + public static class JvmTestResult implements ExecutionResult { + + private final ExecutionResult delegate; + private final List log; + + public JvmTestResult(ExecutionResult delegate, List log) { + this.delegate = delegate; + this.log = log; + } + + @Override + public JvmTestResult assertFailure() { + try { + delegate.assertFailure(); + } catch (AssertionError e) { + final StringBuilder sb = new StringBuilder(e.getMessage()); + sb.append("\n--- received messages start ---"); + synchronized (log) { + log.forEach(s -> sb.append('\n').append(s)); + } + sb.append("\n--- received messages end ---"); + throw new AssertionError(sb.toString(), e); + } + return this; + } + + @Override + public JvmTestResult assertSuccess() { + try { + delegate.assertSuccess(); + } catch (AssertionError e) { + final StringBuilder sb = new StringBuilder(e.getMessage()); + sb.append("\n--- received messages start ---"); + synchronized (log) { + log.forEach(s -> sb.append('\n').append(s)); + } + sb.append("\n--- received messages end ---"); + throw new AssertionError(sb.toString(), e); + } + return this; + } + + @Override + public int getExitCode() { + return delegate.getExitCode(); + } + + @Override + public boolean isSuccess() { + return delegate.isSuccess(); + } + + } + +} diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/MvndTestExtension.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/MvndTestExtension.java index ed9134864..ccedba7db 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/MvndTestExtension.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/MvndTestExtension.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.ExtensionContext.Store; import org.mvndaemon.mvnd.client.Client; import org.mvndaemon.mvnd.client.DaemonParameters; -import org.mvndaemon.mvnd.client.DefaultClient; import org.mvndaemon.mvnd.common.DaemonRegistry; import org.mvndaemon.mvnd.common.Environment; import org.mvndaemon.mvnd.common.TimeUtils; @@ -122,7 +121,7 @@ Client newClient(boolean isNative, DaemonParameters parameters, long timeoutMs) } return new NativeTestClient(parameters, mvndNativeExecutablePath, timeoutMs); } else { - return new DefaultClient(parameters); + return new JvmTestClient(parameters); } } diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java index de1226a7a..65a4b0a27 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/junit/NativeTestClient.java @@ -113,25 +113,28 @@ public Result(List args, int exitCode, List log) { this.log = log; } - StringBuilder appendCommand(StringBuilder sb) { - for (String arg : args) { - sb.append(" \"").append(arg).append('"'); - } - return sb; - - } - + @Override public Result assertFailure() { if (exitCode == 0) { - throw new AssertionError(appendCommand( - new StringBuilder("mvnd returned ").append(exitCode).append(" instead of non-zero exit code: "))); + final StringBuilder sb = ExecutionResult.appendCommand( + new StringBuilder("mvnd returned ").append(exitCode).append(" instead of non-zero exit code: "), + args); + sb.append("\n--- stderr+stdout start ---"); + synchronized (log) { + log.forEach(s -> sb.append('\n').append(s)); + } + sb.append("\n--- stderr+stdout end ---"); + throw new AssertionError(sb); } return this; } + @Override public Result assertSuccess() { if (exitCode != 0) { - final StringBuilder sb = appendCommand(new StringBuilder("mvnd returned ").append(exitCode)); + final StringBuilder sb = ExecutionResult.appendCommand( + new StringBuilder("mvnd returned ").append(exitCode), + args); if (exitCode == CommandProcess.TIMEOUT_EXIT_CODE) { sb.append(" (timeout)"); } @@ -145,10 +148,12 @@ public Result assertSuccess() { return this; } + @Override public int getExitCode() { return exitCode; } + @Override public boolean isSuccess() { return exitCode == 0; } diff --git a/integration-tests/src/test/projects/new-managed-module/changes/bom/pom.xml b/integration-tests/src/test/projects/new-managed-module/changes/bom/pom.xml new file mode 100644 index 000000000..8fd7a6db5 --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/bom/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + ../pom.xml + + + new-managed-module-bom + pom + + + 0.0.1-SNAPSHOT + + + + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-module + ${new-managed-module.version} + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-new-module + ${new-managed-module.version} + + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/changes/module/pom.xml b/integration-tests/src/test/projects/new-managed-module/changes/module/pom.xml new file mode 100644 index 000000000..70b785b36 --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/module/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + ../pom.xml + + + new-managed-module-module + + + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-bom + 0.0.1-SNAPSHOT + pom + import + + + + + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-new-module + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/changes/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java b/integration-tests/src/test/projects/new-managed-module/changes/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java new file mode 100644 index 000000000..4cf284e1b --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java @@ -0,0 +1,26 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.test.upgrades.bom.module; + +import org.mvndaemon.mvnd.test.upgrades.nw.module.Hello; + +public class UseHello { + + public void use() { + System.out.println(new Hello().hi()); + } + +} diff --git a/integration-tests/src/test/projects/new-managed-module/changes/new-module/pom.xml b/integration-tests/src/test/projects/new-managed-module/changes/new-module/pom.xml new file mode 100644 index 000000000..01289229d --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/new-module/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + ../pom.xml + + + new-managed-module-new-module + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/changes/new-module/src/main/java/org/mvndaemon/mvnd/test/upgrades/nw/module/Hello.java b/integration-tests/src/test/projects/new-managed-module/changes/new-module/src/main/java/org/mvndaemon/mvnd/test/upgrades/nw/module/Hello.java new file mode 100644 index 000000000..6258e1a51 --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/new-module/src/main/java/org/mvndaemon/mvnd/test/upgrades/nw/module/Hello.java @@ -0,0 +1,24 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.test.upgrades.nw.module; + +public class Hello { + + public String hi() { + return "Hi"; + } + +} diff --git a/integration-tests/src/test/projects/new-managed-module/changes/pom.xml b/integration-tests/src/test/projects/new-managed-module/changes/pom.xml new file mode 100644 index 000000000..50440e9ae --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/changes/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + pom + + + UTF-8 + 1.8 + 1.8 + + 2.5 + 3.8.0 + 2.4 + 2.6 + 2.22.2 + + + + bom + module + new-module + + + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/parent/.mvn/.gitkeep b/integration-tests/src/test/projects/new-managed-module/parent/.mvn/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/src/test/projects/new-managed-module/parent/bom/pom.xml b/integration-tests/src/test/projects/new-managed-module/parent/bom/pom.xml new file mode 100644 index 000000000..39a19b5ac --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/parent/bom/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + ../pom.xml + + + new-managed-module-bom + pom + + + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-module + ${project.version} + + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/parent/module/pom.xml b/integration-tests/src/test/projects/new-managed-module/parent/module/pom.xml new file mode 100644 index 000000000..04a4cfeec --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/parent/module/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + ../pom.xml + + + new-managed-module-module + + + + + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-bom + 0.0.1-SNAPSHOT + pom + import + + + + + \ No newline at end of file diff --git a/integration-tests/src/test/projects/new-managed-module/parent/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java b/integration-tests/src/test/projects/new-managed-module/parent/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java new file mode 100644 index 000000000..6e8f54ff2 --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/parent/module/src/main/java/org/mvndaemon/mvnd/test/upgrades/bom/module/UseHello.java @@ -0,0 +1,24 @@ +/* + * Copyright 2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mvndaemon.mvnd.test.upgrades.bom.module; + +public class UseHello { + + public void use() { + System.out.println("Hello"); + } + +} diff --git a/integration-tests/src/test/projects/new-managed-module/parent/pom.xml b/integration-tests/src/test/projects/new-managed-module/parent/pom.xml new file mode 100644 index 000000000..1a25cce5b --- /dev/null +++ b/integration-tests/src/test/projects/new-managed-module/parent/pom.xml @@ -0,0 +1,76 @@ + + + + 4.0.0 + org.mvndaemon.mvnd.test.new-managed-module + new-managed-module-parent + 0.0.1-SNAPSHOT + pom + + + UTF-8 + 1.8 + 1.8 + + 2.5 + 3.8.0 + 2.4 + 2.6 + 2.22.2 + + + + bom + module + + + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + \ No newline at end of file