org.jgroups.util.WriteVersionTo Maven / Gradle / Ivy
package org.jgroups.util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.*;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicReference;
/**
* Extracts version and codename from pom.xml and writes them to ./classes/JGROUPS_VERSION.properties
* @author Bela Ban
* @since 5.0.0
*/
public class WriteVersionTo {
public static void main(String[] args) throws IOException {
String pom="pom.xml";
String input="./conf/JGROUPS_VERSION.properties";
String output="./classes/JGROUPS_VERSION.properties";
String jgroups_version="jgroups.version", jgroups_codename="jgroups.codename";
for(int i=0; i < args.length; i++) {
switch(args[i]) {
case "-pom":
pom=args[++i];
break;
case "-input":
input=args[++i];
break;
case "-output":
output=args[++i];
break;
case "-version":
jgroups_version=args[++i];
break;
case "-codename":
jgroups_codename=args[++i];
break;
default:
System.out.printf("%s [-pom POM] [-input ] [-output