Gogs 7 år sedan
förälder
incheckning
758e9add6f
3 ändrade filer med 41 tillägg och 2 borttagningar
  1. 37 1
      pom.xml
  2. 2 0
      src/main/java/org/robert/printer/App.java
  3. 2 1
      src/main/java/org/robert/printer/ui/Tray.java

+ 37 - 1
pom.xml

@@ -43,7 +43,7 @@
 		<dependency>
 			<groupId>com.dorkbox</groupId>
 			<artifactId>SystemTray</artifactId>
-			<version>3.11</version>
+			<version>3.12</version>
 		</dependency>
 		<!-- https://mvnrepository.com/artifact/org.json/json -->
 		<dependency>
@@ -69,6 +69,42 @@
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>3.0.2</version>
+				<executions>
+					<execution>
+						<id>default-jar</id>
+						<phase>package</phase>
+						<goals>
+							<goal>jar</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-resources-plugin</artifactId>
+				<version>3.0.2</version>
+				<executions>
+					<execution>
+						<id>copy-resources</id>
+						<phase>process-resources</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/classes/org/robert/printer/ui/resources</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/java/org/robert/printer/ui/resources</directory>
+									<filtering>true</filtering>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 </project>

+ 2 - 0
src/main/java/org/robert/printer/App.java

@@ -29,6 +29,8 @@ public class App {
 			tray.setupServer(new PrintersSocketServer());
 		} catch (Exception e) {
 			e.printStackTrace();
+
+			System.exit(0);
 		}
 	}
 }

+ 2 - 1
src/main/java/org/robert/printer/ui/Tray.java

@@ -23,7 +23,7 @@ public class Tray {
 			return;
 		}
 
-		this.systemTray.setImage(Tray.class.getResource("./resources/printer_ok.png"));
+		this.systemTray.setImage(this.getClass().getResource("resources/printer_ok.png"));
 
 		MenuItem startServerMenu = new MenuItem("Arrancar servidor", new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
@@ -78,6 +78,7 @@ public class Tray {
 	 */
 	protected void quitActionListener(ActionEvent e) {
 		this.systemTray.shutdown();
+		System.exit(0);
 	}
 
 	/**