Moved config file and fixed some warnings

This commit is contained in:
Jacob Swehla 2017-12-29 11:25:31 -06:00
parent fde79ed97e
commit b43cf9ac33
3 changed files with 38 additions and 27 deletions

View File

@ -3,24 +3,37 @@
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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.simon987.server</groupId>
<artifactId>server_root</artifactId>
<version>1.2a</version>
</parent>
<build>
<resources>
<resource>
<directory>../Server/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>config.properties</include>
</includes>
</resource>
</resources>
<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>
<version>3.6.2</version>
<groupId>org.apache.maven.plugins</groupId>
@ -50,6 +63,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<outputDirectory>../target</outputDirectory>
<archive>
@ -93,4 +107,9 @@
</dependencies>
<properties>
<!-- explicitly set build encoding so not altered by build platform defaults -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -22,7 +22,7 @@ public class ServerConfiguration {
public ServerConfiguration(String file) {
try {
properties = new Properties();
InputStream is = ServerConfiguration.class.getClassLoader().getResourceAsStream("config.properties");
InputStream is = new FileInputStream("config.properties");
properties.load(is);
} catch (IOException e) {

14
pom.xml
View File

@ -13,26 +13,18 @@
<build>
<plugins>
<plugin>
<version>3.6.2</version>
<groupId>org.apache.maven.plugins</groupId>
<version>3.6.2</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<outputDirectory>../target/plugins</outputDirectory>
<archive>