<modelVersion>4.0.0</modelVersion>
- <groupId>de.republlb</groupId>
+ <groupId>de.republib</groupId>
<artifactId>pinet</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<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>
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;
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.
*
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);