import os import xml.etree.ElementTree as ET import shutil import gen if (os.getcwd().endswith("SpigotPluginBaseTools/")): os.chdir("../") pom_xml = ET.parse(gen.find_pom_xml()) pom_root = pom_xml.getroot() proj_name = pom_root.find("{" + gen.POM_NAMESPACE + "}" + "name").text plugin_ver = pom_root.find("{" + gen.POM_NAMESPACE + "}" + "version").text plugin_filename = proj_name + "-" + plugin_ver + ".jar" plugin_dir = gen.DEV_SERVER_PATH + "plugins/" if not os.path.exists(plugin_dir): os.mkdir(plugin_dir) plugin_path = gen.find_pom_xml_dir() + "/target/{0}".format(plugin_filename) if not os.path.exists(plugin_path): print("Could not find \"{0}\". Is it packaged?".format(plugin_path)) exit(1) shutil.copy(plugin_path, plugin_dir + plugin_filename) print("Copied \"{0}\" to \"{1}\".".format(plugin_path, plugin_dir + plugin_filename))