import os import xml.etree.ElementTree as ET import shutil import gen if (os.getcwd().endswith("SpigotPluginBaseTools/")): os.chdir("../") pomxml = ET.parse(gen.find_pomxml()) pomroot = pomxml.getroot() projname = pomroot.find("{" + gen.POM_NAMESPACE + "}" + "name").text pluginver = pomroot.find("{" + gen.POM_NAMESPACE + "}" + "version").text pluginfilename = projname + "-" + pluginver + ".jar" plugindir = gen.DEV_SERVER_PATH + "plugins/" if not os.path.exists(plugindir): os.mkdir(plugindir) pluginpath = gen.find_pomxmldir() + "/target/{0}".format(pluginfilename) if not os.path.exists(pluginpath): print("Could not find \"{0}\". Is it packaged?".format(pluginpath)) exit(1) shutil.copy(pluginpath, plugindir + pluginfilename) print("Copied \"{0}\" to \"{1}\".".format(pluginpath, plugindir + pluginfilename))