Browse Source

Adding build support

Zoey76 6 years ago
parent
commit
771932c121

+ 43 - 0
pom.xml

@@ -18,6 +18,10 @@
 		<commons-configuration2.version>2.4</commons-configuration2.version>
 		<commons-beanutils.version>1.9.3</commons-beanutils.version>
 		<asciitable.version>0.3.2</asciitable.version>
+		<!-- Plugins -->
+		<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
+		<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
+		<maven-assembly-plugin.version>3.1.1</maven-assembly-plugin.version>
 	</properties>
 	<dependencies>
 		<dependency>
@@ -66,4 +70,43 @@
 			<version>${asciitable.version}</version>
 		</dependency>
 	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>${maven-jar-plugin.version}</version>
+				<configuration>
+					<finalName>l2jcli</finalName>
+					<archive>
+						<manifest>
+							<addClasspath>true</addClasspath>
+							<classpathPrefix>libs/</classpathPrefix>
+							<mainClass>com.l2jserver.cli.L2JServerCLI</mainClass>
+						</manifest>
+					</archive>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<version>${maven-assembly-plugin.version}</version>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+						<configuration>
+							<finalName>l2jcli</finalName>
+							<appendAssemblyId>false</appendAssemblyId>
+							<descriptors>
+								<descriptor>src/main/assembly/zip.xml</descriptor>
+							</descriptors>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>

+ 30 - 0
src/main/assembly/zip.xml

@@ -0,0 +1,30 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+	<id>zip</id>
+	<includeBaseDirectory>false</includeBaseDirectory>
+	<formats>
+		<format>zip</format>
+	</formats>
+	<files>
+		<file>
+			<source>${project.build.directory}/l2jcli.jar</source>
+			<outputDirectory>.</outputDirectory>
+		</file>
+		<file>
+			<source>src/main/resources/l2jcli.bat</source>
+			<outputDirectory>.</outputDirectory>
+		</file>
+		<file>
+			<source>src/main/resources/l2jcli.sh</source>
+			<outputDirectory>.</outputDirectory>
+		</file>
+	</files>
+	<dependencySets>
+		<dependencySet>
+			<outputDirectory>libs</outputDirectory>
+			<excludes>
+				<exclude>${project.groupId}:${project.artifactId}:jar:*</exclude>
+			</excludes>
+		</dependencySet>
+	</dependencySets>
+</assembly>

+ 3 - 1
src/main/java/com/l2jserver/cli/L2JServerCLI.java

@@ -29,6 +29,7 @@ import com.l2jserver.cli.command.ConfigurationEditorGUICommand;
 import com.l2jserver.cli.command.DatabaseCommand;
 import com.l2jserver.cli.command.DeployCommand;
 import com.l2jserver.cli.command.GameServerCommand;
+import com.l2jserver.cli.command.HelpCommand;
 import com.l2jserver.cli.command.QuitCommand;
 
 import picocli.CommandLine;
@@ -38,13 +39,14 @@ import picocli.CommandLine.Command;
  * L2J Server CLI.
  * @author Zoey76
  */
-@Command(name = "", version = "1.0", subcommands = {
+@Command(name = "l2jcli", version = "1.0", subcommands = {
 	CodeCommand.class,
 	BuildCommand.class,
 	DeployCommand.class,
 	DatabaseCommand.class,
 	GameServerCommand.class,
 	AccountCommand.class,
+	HelpCommand.class,
 	QuitCommand.class,
 	ConfigurationEditorGUICommand.class
 })

+ 34 - 0
src/main/java/com/l2jserver/cli/command/HelpCommand.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2019 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.cli.command;
+
+import picocli.CommandLine.Command;
+
+/**
+ * Help command.
+ * @author Zoey76
+ */
+@Command(name = "help", aliases = "h")
+public class HelpCommand extends AbstractCommand {
+	
+	@Override
+	public void run() {
+		// TODO(Zoey76): Implement.
+	}
+}

+ 2 - 0
src/main/resources/l2jcli.bat

@@ -0,0 +1,2 @@
+@echo off
+java -jar l2jcli.jar

+ 2 - 0
src/main/resources/l2jcli.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+java -jar l2jcli.jar