]> gitweb.hamatoma.de Git - jpinet/commitdiff
Client: -v option, pom.xml: scm
authorhama <hama@siduction.net>
Sun, 31 Jul 2016 13:33:39 +0000 (15:33 +0200)
committerhama <hama@siduction.net>
Sun, 31 Jul 2016 13:33:39 +0000 (15:33 +0200)
pom.xml
resources/jpinet.sh
src/main/java/de/republib/pinet/Client.java

diff --git a/pom.xml b/pom.xml
index 7e2ff0afeae6175f70222761d4d718849c1d05ce..11b6f81453e8952efece88e7a807b45ca4ff8da7 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 
        <modelVersion>4.0.0</modelVersion>
 
-       <groupId>de.republlb</groupId>
+       <groupId>de.republib</groupId>
        <artifactId>pinet</artifactId>
        <packaging>jar</packaging>
        <version>1.0-SNAPSHOT</version>
@@ -13,7 +13,7 @@
        <url>https://sourcefourge.net</url>
        <scm>
                <connection>scm:git:git@git.hamatoma.de:repo/jpinet</connection>
-               <developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
+               <developerConnection>scm:git:git@git.hamatoma.de:repo/jpinet</developerConnection>
                <url>http://somerepository.com/view.cvs</url>
        </scm>
        <properties>
                                        <archive>
                                                <manifest>
                                                        <mainClass>de.republib.pinet.Client</mainClass>
+                                                       <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                                                       <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                                </manifest>
                                        </archive>
                                </configuration>
index 922a9affb0f4297fc29d17139d229df775f0c664..e0850371935406c6623f3066a40fe0a57d9498b1 100755 (executable)
@@ -14,7 +14,7 @@ if [ -z "$found" ] ; then
        echo "+++ missing pinet*-with-dependencies.jar"
 else
        echo "starting $full..."
-       java -jar $full de.republib.pinet.Client
+       java -jar $full $*
 fi
 
        
index 670b85632fe6d922a24fda95017b065051fd4897..1dc3ff49567dfabf22da9a379389467ef2231da0 100644 (file)
@@ -1,5 +1,10 @@
 package de.republib.pinet;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -16,6 +21,25 @@ public class Client {
                client.blink(PinNumber.PIN_RPi2_12, 10, 500, 500);
        }
 
+       public static String getVersion() {
+               String rc = null;
+               final InputStream resourceAsStream = Client.class.getResourceAsStream("/META-INF/MANIFEST.MF");
+               final BufferedReader reader = new BufferedReader(new InputStreamReader(resourceAsStream));
+               String line;
+               final String prefix = "Implementation-Version: ";
+               try {
+                       while ((line = reader.readLine()) != null) {
+                               if (line.startsWith(prefix)) {
+                                       rc = line.substring(prefix.length()).trim();
+                                       break;
+                               }
+                       }
+               } catch (final IOException e) {
+                       Client.logger.error("cannot read pom.properties['version']");
+               }
+               return rc;
+       }
+
        /**
         * Starts the graphical user interface client.
         *
@@ -46,6 +70,9 @@ public class Client {
                        if (arg.startsWith("-p") || arg.startsWith("--port=")) {
                                arg = arg.substring(arg.charAt(1) == '-' ? 2 : 7);
                                port = Integer.parseInt(arg);
+                       } else if (arg.startsWith("-v") || arg.startsWith("--version")) {
+                               System.out.println(Client.getVersion());
+                               System.exit(1);
                        }
                }
                Client.gui(host, port);