protected static int calculatePort(String projectVersion){
  int basePort=4;
  String number;
  int dashIndex=projectVersion.indexOf('-');
  boolean snapshot=false;
  if (dashIndex > -1) {
    number=projectVersion.substring(0,dashIndex);
    snapshot=true;
  }
 else {
    number=projectVersion;
  }
  number=number.replaceAll("\\Q.\\E","");
  int numLength=number.length();
  if (number.length() >= 3) {
    number=number.substring(numLength - 3,numLength);
  }
  while (number.length() < 3) {
    number+="0";
  }
  if (snapshot) {
    number+="1";
  }
 else {
    number+="0";
  }
  number=basePort + number;
  return Integer.parseInt(number);
}

protected static int calculatePort ( String projectVersion ) { int basePort = 4 ; String number ; int dashIndex = projectVersion . indexOf ( '-' ) ; boolean snapshot = false ; if ( dashIndex > - 1 ) { number = projectVersion . substring ( 0 , dashIndex ) ; snapshot = true ; } else { number = projectVersion ; } number = number . replaceAll ( "\\Q.\\E" , "" ) ; int numLength = number . length ( ) ; if ( number . length ( ) >= 3 ) { number = number . substring ( numLength - 3 , numLength ) ; } while ( number . length ( ) < 3 ) { number += "0" ; } if ( snapshot ) { number += "1" ; } else { number += "0" ; } number = basePort + number ; return Integer . parseInt ( number ) ; }
calculates a ( semi - unique ) four or five digit port based off of the version number . will always start with a four .
