]> www.vanbest.org Git - tv_grab_nl_java/commitdiff
Schrijf project.version uit pom.xml naar properties file en gebruik in programma
authorJP <jp@here>
Wed, 21 Mar 2012 13:43:50 +0000 (14:43 +0100)
committerJP <jp@here>
Wed, 21 Mar 2012 13:43:50 +0000 (14:43 +0100)
pom.xml
src/main/java/org/vanbest/xmltv/Config.java
src/main/java/org/vanbest/xmltv/Main.java
src/main/java/org/vanbest/xmltv/XmlTvWriter.java
src/main/resources/tv_grab_nl_java.properties [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index 707899c0b40de9dfeb47a280cd858f962b8b0165..b7e8e5013c4bb6f1d0398b75398019306b4e0d34 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                        </plugin>
 
                </plugins>
+               
+      <resources>
+        <resource>
+          <directory>src/main/resources</directory>
+          <filtering>true</filtering>
+        </resource>
+      </resources>
+         
        </build>
 
 </project>
index f112293a5fae57138c5bac2dcdb1b94f3b9fa041..506c42712fdecac03bf602f8b5245fc20feb65b0 100644 (file)
@@ -7,6 +7,7 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
@@ -14,6 +15,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.commons.io.FileUtils;
 
@@ -30,8 +32,18 @@ public class Config {
        private static final int LOG_PROGRAMME_INFO = 0x0200;
        
        public static int LOG_DEFAULT = LOG_INFO;
+
+       String project_version;
        
        private Config() {
+               Properties configProp = new Properties();
+        InputStream in = this.getClass().getResourceAsStream("tv_grab_nl_java.properties");
+        try {
+            configProp.load(in);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        project_version=configProp.getProperty("project.version");
        }
        
        public static Config getDefaultConfig() {
index 9aaf65dd9e3b3302d41e58225539eb1f1e3f7d19..478f2453235582f2b029be7b1c8191607622496c 100644 (file)
@@ -178,6 +178,7 @@ public class Main {
                }
                
                if (line.hasOption("d")) {
+                       System.out.println("tv_grab_nl_java version " + config.project_version);
                        System.out.println("tv_grab_nl_java is a parser for Dutch TV listings using the tvgids.nl JSON interface");
                        System.exit(0);
                }
index 61d211a1f75a999ae6140a448803100aa36b449f..90b735cb554852c513d33dd235a744d6698191fc 100644 (file)
@@ -31,7 +31,7 @@ public class XmlTvWriter {
                writer.writeAttribute("generator-info-url","http://www.vanbest.org/");
                writer.writeAttribute("source-info-url", "http://tvgids.nl/");
                writer.writeAttribute("source-info-name", "TvGids.nl");
-               writer.writeAttribute("generator-info-name", "tv_grab_nl_java release 0.4");
+               writer.writeAttribute("generator-info-name", "tv_grab_nl_java release "+config.project_version);
                writeln();
        }
        
diff --git a/src/main/resources/tv_grab_nl_java.properties b/src/main/resources/tv_grab_nl_java.properties
new file mode 100644 (file)
index 0000000..70ce476
--- /dev/null
@@ -0,0 +1,3 @@
+project.version=${project.version}
+project.name=${project.name}
+project.description=${project.description}
\ No newline at end of file