Skip to content

Commit

Permalink
Pass QTM version through maven model.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnr1990 authored and arnikz committed Mar 7, 2018
1 parent 133e697 commit 80a5dfb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion QTM
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

java -Xmx512m -jar target/QTM-1.0-SNAPSHOT.jar $*
java -Xmx512m -jar target/QTM-1.0.jar $*
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.wur</groupId>
<artifactId>QTM</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -62,6 +62,12 @@
<version>1.4_rc3</version>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.3.9</version>
</dependency>

<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/qtm/QtmMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.commons.io.FilenameUtils;

import readers.PmcMetaReader;
import resultDb.QtlDb;
import utils.Configs;
Expand All @@ -39,7 +39,14 @@ public static void main(String[] args) throws IOException {

if (Arrays.asList(args).contains("-v")
| Arrays.asList(args).contains("--version")) {
System.out.println("1.0 ");
try{
MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = reader.read(new FileReader("pom.xml"));
System.out.println(model.getVersion());
}
catch(Exception e){
e.printStackTrace();
}
return;
}

Expand All @@ -52,10 +59,10 @@ public static void main(String[] args) throws IOException {
+ ".db";
}
}

// (re)start Solr server
controlSolr("restart");

String inputFile = args[0];
ArrayList<String> pmcIds = new ArrayList<String>();
BufferedReader reader = null;
Expand Down Expand Up @@ -196,7 +203,7 @@ public static long bytesToMegabytes(long bytes) {

public static void controlSolr(String cmd) {
System.out.println("Solr server has been " + cmd + "ed.");
System.out.println("--------------------------------------------");
System.out.println("--------------------------------------------");
try {
String[] cmdline = {Configs.getPropertyQTM("solrRun"), cmd,
Configs.getPropertyQTM("solrPort"),
Expand All @@ -209,7 +216,7 @@ public static void controlSolr(String cmd) {
}
System.out.println("\n");
}

public static void printHelp() {
System.out.println("\nDESCRIPTION");
System.out.println("===========");
Expand Down

0 comments on commit 80a5dfb

Please sign in to comment.