diff --git a/pom.xml b/pom.xml
index 808b213..f9f1b34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
${project.basedir}/server.
+ */
+ @Parameter(defaultValue = "${project.basedir}/server")
+ private File serverDirectory;
+
+ /**
+ * File name for the downloaded or provided server jar, relative to {@code serverDirectory}.
+ * Defaults to server.jar.
+ */
+ @Parameter(defaultValue = "server.jar")
+ private String serverJarName;
+
+ /**
+ * The server software to download. Defaults to paper.
+ * Can be one paper or spigot.
+ */
+ @Parameter(defaultValue = "paper")
+ private String serverSoftware;
+
+ /**
+ * When {@code true}, automatically creates {@code eula.txt} with {@code eula=true}
+ * in the server directory if it does not already exist, bypassing the manual
+ * acceptance step. Defaults to {@code false}.
+ *
+ *
By setting this to {@code true} you are indicating that you accept the + * Minecraft End User License Agreement.
+ */ + @Parameter(defaultValue = "false") + private boolean acceptEula; + + /** + * The Minecraft version to run, e.g.1.21.4. Required.
+ */
+ @Parameter(required = true)
+ private String mcVersion;
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ Step> step = new ServerInstallStep(getLog(),
+ new ServerInstallConfig(serverDirectory, pluginJar, serverJarName, serverSoftware, mcVersion, acceptEula)
+ );
+ try {
+ step.run();
+ } catch (StepExecutionException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+}
diff --git a/src/main/java/org/strassburger/mcrun/RunServerMojo.java b/src/main/java/org/strassburger/mcrun/RunServerMojo.java
new file mode 100644
index 0000000..491efdb
--- /dev/null
+++ b/src/main/java/org/strassburger/mcrun/RunServerMojo.java
@@ -0,0 +1,95 @@
+package org.strassburger.mcrun;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.strassburger.mcrun.config.ServerRunStepConfig;
+import org.strassburger.mcrun.steps.ServerRunStep;
+import org.strassburger.mcrun.steps.Step;
+import org.strassburger.mcrun.steps.StepExecutionException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+@Mojo(name = "run")
+public class RunServerMojo extends AbstractMojo {
+ /**
+ * Heap size passed to both {@code -Xmx} and {@code -Xms}.
+ * Accepts standard JVM memory notation, e.g. 2G, 512M.
+ * Defaults to 2G.
+ */
+ @Parameter(defaultValue = "2G")
+ private String memory;
+
+ /**
+ * Additional JVM arguments to pass to the server process.
+ * These are inserted after -Xmx/-Xms and before -jar.
+ *
+ * {@code
+ *
+ * -XX:+UseG1GC
+ * -XX:+ParallelRefProcEnabled
+ *
+ * }
+ */
+ @Parameter
+ private Listtrue, the JVM is launched with:
+ * -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:{debugPort}.
+ * Attach your IDE's remote debugger to the configured {@code debugPort} to use this feature.
+ * Defaults to false.
+ */
+ @Parameter(defaultValue = "false")
+ private boolean remoteDebug;
+
+ /**
+ * The port the JDWP remote debugger will listen on when {@code remoteDebug} is enabled.
+ * Defaults to 5005.
+ *
+ * {@code
+ * true
+ * 5005
+ * }
+ */
+ @Parameter(defaultValue = "5005")
+ private int debugPort;
+
+ /**
+ * The port the Minecraft server will listen on. Passed to the server via --port.
+ */
+ @Parameter
+ private Integer port;
+
+ /**
+ * Directory where the test server will be created and run.
+ * The server jar, plugins folder, and all generated files (eula.txt, world, logs, etc.)
+ * will be placed here. Defaults to ${project.basedir}/server.
+ */
+ @Parameter(defaultValue = "${project.basedir}/server")
+ private File serverDirectory;
+
+ /**
+ * File name for the downloaded or provided server jar, relative to {@code serverDirectory}.
+ * Defaults to server.jar.
+ */
+ @Parameter(defaultValue = "server.jar")
+ private String serverJarName;
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ Step> step = new ServerRunStep(getLog(),
+ new ServerRunStepConfig(memory, jvmArgs, remoteDebug, debugPort, port, serverDirectory, serverJarName)
+ );
+ try {
+ step.run();
+ } catch (StepExecutionException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+}
diff --git a/src/main/java/org/strassburger/mcrun/StartServerMojo.java b/src/main/java/org/strassburger/mcrun/StartServerMojo.java
index c7ed8e2..7108b77 100644
--- a/src/main/java/org/strassburger/mcrun/StartServerMojo.java
+++ b/src/main/java/org/strassburger/mcrun/StartServerMojo.java
@@ -88,9 +88,25 @@ public class StartServerMojo extends AbstractMojo {
@Parameter
private Listtrue, the JVM is launched with:
+ * -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:{debugPort}.
+ * Attach your IDE's remote debugger to the configured {@code debugPort} to use this feature.
+ * Defaults to false.
+ */
@Parameter(defaultValue = "false")
private boolean remoteDebug;
+ /**
+ * The port the JDWP remote debugger will listen on when {@code remoteDebug} is enabled.
+ * Defaults to 5005.
+ *
+ * {@code
+ * true
+ * 5005
+ * }
+ */
@Parameter(defaultValue = "5005")
private int debugPort;