Browse Source

[IMP] maven packaging

Gogs 7 years ago
parent
commit
ea3ec93660

+ 68 - 49
pom.xml

@@ -1,55 +1,74 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" 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>
+	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>
 
-  <groupId>org.robert</groupId>
-  <artifactId>printers-tray</artifactId>
-  <version>0.0.1-SNAPSHOT</version>
-  <packaging>jar</packaging>
+	<groupId>org.robert</groupId>
+	<artifactId>printers-tray</artifactId>
+	<version>0.0.1</version>
+	<packaging>jar</packaging>
 
-  <name>printer-tray</name>
-  <url>http://maven.apache.org</url>
+	<name>printer-tray</name>
+	<url>http://maven.apache.org</url>
 
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
 
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
-    </dependency>
-     <!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server -->
-	<dependency>
-	    <groupId>org.eclipse.jetty</groupId>
-	    <artifactId>jetty-server</artifactId>
-	    <version>9.4.7.v20170914</version>
-	</dependency>
-	<!-- https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/websocket-server -->
-	<dependency>
-	    <groupId>org.eclipse.jetty.websocket</groupId>
-	    <artifactId>websocket-server</artifactId>
-	    <version>9.4.7.v20170914</version>
-	</dependency>
-	<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
-	<dependency>
-	    <groupId>commons-io</groupId>
-	    <artifactId>commons-io</artifactId>
-	    <version>2.5</version>
-	</dependency>
-	   <!-- https://mvnrepository.com/artifact/com.dorkbox/SystemTray -->
-	<dependency>
-	    <groupId>com.dorkbox</groupId>
-	    <artifactId>SystemTray</artifactId>
-	    <version>3.11</version>
-	</dependency>
-	<!-- https://mvnrepository.com/artifact/org.json/json -->
-	<dependency>
-	    <groupId>org.json</groupId>
-	    <artifactId>json</artifactId>
-	    <version>20171018</version>
-	</dependency>
-  </dependencies>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server -->
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-server</artifactId>
+			<version>9.4.7.v20170914</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/websocket-server -->
+		<dependency>
+			<groupId>org.eclipse.jetty.websocket</groupId>
+			<artifactId>websocket-server</artifactId>
+			<version>9.4.7.v20170914</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>2.5</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/com.dorkbox/SystemTray -->
+		<dependency>
+			<groupId>com.dorkbox</groupId>
+			<artifactId>SystemTray</artifactId>
+			<version>3.11</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.json/json -->
+		<dependency>
+			<groupId>org.json</groupId>
+			<artifactId>json</artifactId>
+			<version>20171018</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/lib</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>

+ 5 - 0
run.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+for f in *; do
+	echo $f
+done

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

@@ -20,7 +20,6 @@ public class App {
 	public static void main(String[] args) {
 		try {
 			SwingUtilities.invokeAndWait(new Runnable() {
-				@Override
 				public void run() {
 					tray = new Tray();
 					tray.start();

+ 0 - 6
src/main/java/org/robert/printer/common/PrinterProcessor.java

@@ -42,31 +42,25 @@ public class PrinterProcessor {
 
 		final AtomicBoolean finished = new AtomicBoolean(false);
 		job.addPrintJobListener(new PrintJobListener() {
-			@Override
 			public void printJobRequiresAttention(PrintJobEvent pje) {
 			}
 
-			@Override
 			public void printJobNoMoreEvents(PrintJobEvent pje) {
 				finished.set(true);
 			}
 
-			@Override
 			public void printJobFailed(PrintJobEvent pje) {
 				finished.set(true);
 			}
 
-			@Override
 			public void printJobCompleted(PrintJobEvent pje) {
 				finished.set(true);
 			}
 
-			@Override
 			public void printJobCanceled(PrintJobEvent pje) {
 				finished.set(true);
 			}
 
-			@Override
 			public void printDataTransferCompleted(PrintJobEvent pje) {
 				finished.set(true);
 			}

+ 4 - 0
src/main/java/org/robert/printer/ws/PrintersSocketHandler.java

@@ -2,6 +2,7 @@ package org.robert.printer.ws;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.UUID;
 
 import javax.print.PrintException;
 
@@ -36,6 +37,9 @@ public class PrintersSocketHandler {
 	@OnWebSocketConnect
 	public void onConnect(Session session) {
 		this.getConnections().put(session.getRemoteAddress().getPort(), new SocketConnection());
+
+		UUID socketId = UUID.randomUUID();
+		System.out.println(socketId);
 	}
 
 	/**

+ 2 - 1
src/main/java/org/robert/printer/ws/PrintersSocketServer.java

@@ -19,7 +19,7 @@ public class PrintersSocketServer {
 
 	public PrintersSocketServer() {
 		this.host = "0.0.0.0";
-		this.port = 8700;
+		this.port = 8070;
 		this.running = new AtomicBoolean(false);
 	}
 
@@ -81,6 +81,7 @@ public class PrintersSocketServer {
 
 		this.server.setHandler(wsHandler);
 		this.server.setStopAtShutdown(true);
+
 		this.server.start();
 
 		this.running.set(true);

BIN
target/classes/org/robert/printer/App$1.class


BIN
target/classes/org/robert/printer/App.class


BIN
target/classes/org/robert/printer/common/PrintersDiscovery.class


BIN
target/classes/org/robert/printer/common/PrintingActions.class


BIN
target/classes/org/robert/printer/ws/PrintersSocketHandler.class


BIN
target/classes/org/robert/printer/ws/PrintersSocketServer$1.class


BIN
target/classes/org/robert/printer/ws/PrintersSocketServer.class


BIN
target/classes/org/robert/printer/ws/SocketConnection.class


BIN
target/test-classes/org/robert/printer/AppTest.class