private void createProperty(){
  Map<String,String> locationProperties=new TreeMap<>();
  locationProperties.put("build","${basedir}/build");
  locationProperties.put("build.classes","${build}/classes");
  locationProperties.put("src.dir","${basedir}/src");
  Element nameProperty=doc.createElement("property");
  nameProperty.setAttribute("name","name");
  nameProperty.setAttribute("value",projectName);
  Node node=root.getFirstChild();
  node=root.insertBefore(nameProperty,node);
  for (  Map.Entry<String,String> locationProperty : locationProperties.entrySet()) {
    Element locationElement=doc.createElement("property");
    locationElement.setAttribute("name",locationProperty.getKey());
    locationElement.setAttribute("location",locationProperty.getValue());
    node=node.getNextSibling();
    node=root.insertBefore(locationElement,node);
  }
}

private void createProperty ( ) { Map < String , String > locationProperties = new TreeMap < > ( ) ; locationProperties . put ( "build" , "${basedir}/build" ) ; locationProperties . put ( "build.classes" , "${build}/classes" ) ; locationProperties . put ( "src.dir" , "${basedir}/src" ) ; Element nameProperty = doc . createElement ( "property" ) ; nameProperty . setAttribute ( "name" , "name" ) ; nameProperty . setAttribute ( "value" , projectName ) ; Node node = root . getFirstChild ( ) ; node = root . insertBefore ( nameProperty , node ) ; for ( Map . Entry < String , String > locationProperty : locationProperties . entrySet ( ) ) { Element locationElement = doc . createElement ( "property" ) ; locationElement . setAttribute ( "name" , locationProperty . getKey ( ) ) ; locationElement . setAttribute ( "location" , locationProperty . getValue ( ) ) ; node = node . getNextSibling ( ) ; node = root . insertBefore ( locationElement , node ) ; } }
create property tag . < property name = " value " { location , value } = " value " / >
