Merge pull request #60 from ScarySpider/More-Maven-fixes

More maven fixes
This commit is contained in:
Simon Fortier 2017-12-29 13:48:56 -05:00 committed by GitHub
commit bd276e0a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 76 additions and 26 deletions

3
.gitignore vendored
View File

@ -12,3 +12,6 @@ mar.log.lck
plugins/*.jar plugins/*.jar
save.json save.json
Server/Server.iml Server/Server.iml
target/*
Server/Server.iml
Server/src/main/java/META-INF/MANIFEST.MF

View File

@ -6,9 +6,6 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/${parent.project.basedir}/ServerTarget" />
<excludeFolder url="file://$MODULE_DIR$/ServerTarget" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />

View File

@ -3,15 +3,37 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.simon987.server</groupId>
<artifactId>server_root</artifactId>
<version>1.2a</version>
</parent>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>default-resources</id>
<!-- here the phase you need -->
<phase>prepare-package</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<outputDirectory>../target/</outputDirectory>
<resources>
<resource>
<directory>../Server/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>config.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<version>3.6.2</version> <version>3.6.2</version>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -21,11 +43,36 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>../target/libs</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration> <configuration>
<outputDirectory>../target</outputDirectory> <outputDirectory>../target</outputDirectory>
<archive>
<manifest>
<mainClass>net.simon987.server.Main</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
</manifest>
</archive>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -60,4 +107,9 @@
</dependencies> </dependencies>
<properties>
<!-- explicitly set build encoding so not altered by build platform defaults -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project> </project>

View File

@ -40,7 +40,7 @@ public class GameServer implements Runnable {
public GameServer() { public GameServer() {
this.config = new ServerConfiguration(new File("config.properties")); this.config = new ServerConfiguration("config.properties");
gameUniverse = new GameUniverse(config); gameUniverse = new GameUniverse(config);
pluginManager = new PluginManager(); pluginManager = new PluginManager();

View File

@ -12,8 +12,7 @@ public class Main {
LogManager.initialize(); LogManager.initialize();
ServerConfiguration config = new ServerConfiguration(new File("config.properties")); ServerConfiguration config = new ServerConfiguration("config.properties");
//Load //Load
GameServer.INSTANCE.getGameUniverse().load(new File("save.json")); GameServer.INSTANCE.getGameUniverse().load(new File("save.json"));

View File

@ -6,6 +6,7 @@ import net.simon987.server.logging.LogManager;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
/** /**
@ -18,11 +19,11 @@ public class ServerConfiguration {
*/ */
private Properties properties; private Properties properties;
public ServerConfiguration(File file) { public ServerConfiguration(String file) {
try { try {
properties = new Properties(); properties = new Properties();
InputStream is = new FileInputStream("config.properties");
properties.load(new FileInputStream(file)); properties.load(is);
} catch (IOException e) { } catch (IOException e) {
LogManager.LOGGER.severe("Problem loading server configuration: " + e.getMessage()); LogManager.LOGGER.severe("Problem loading server configuration: " + e.getMessage());

20
pom.xml
View File

@ -13,28 +13,26 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<version>3.6.2</version>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<version>3.6.2</version>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<version>3.6.2</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration> <configuration>
<outputDirectory>../target/plugins</outputDirectory> <outputDirectory>../target/plugins</outputDirectory>
<archive>
<manifest>
<addClasspath>false</addClasspath>
<mainClass>net.simon987.server.Main</mainClass>
</manifest>
</archive>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

Binary file not shown.

Binary file not shown.

Binary file not shown.