org.jgroups.util.WriteVersionTo Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.util;
import org.jgroups.Version;
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