Guide - How to auto-export your plugin using ant - Historical

Applied By BionixGamer: May 9, 2018 at 7:49 PM

Guide - How to auto-export your plugin using ant
Hello Spigot Community! I have seen a lot threads like ~Auto Export in Eclipse~, but none was really easy to understand. So, I hope this one will help you! So, you have your project which looks like that:

So, we'll begin with STEP 1
  1. Create a new XML-File in the SRC-Folder:
    1. Right-click on the SRC-Folder
    2. NEW --> OTHER... --> XML --> XML-File
    3. Set name to "Build.xml", Press OK
This is the "Script" which will export your Project!

2. Paste this into the File:

Code (Text):
<?xml version="1.0" ?>
<project name="AutoExport" default="CreateJar">
  <property name="plugins" location="C://Users/yourUser/Desktop/minecraftserver/plugins"  />

  <target name="CreateJar" description="Create Jar file"> he
       <jar jarfile="${plugins}/NAME_OF_JARl.jar" basedir="" includes="*.yml, **/*.*"/>
*NOTE! Make sure that you've got **/*.* if you've only got one *, you'll be building manifest only jar files!

3. Change NAME_OF_JAR & "C://Users/yourUser/Desktop/minecraftserver/plugins" to your "needs"
(The Name of the .Jar file which will be created and the path of your plugin-folder)
Now, STEP 2
  1. Right-click your Project (Project)
  2. Click on PROPERTIES
  3. Go to "Builders"
  4. Click on NEW... ---> ANT BUILDER
  6. Go to YOUR PROJECT and click on SRC
  7. Select the BUILD.XML file we just created and click OK
  8. Go to the tab TARGETS
  9. Click SET TARGETS... (Do this for ALL 4 Fields)
  10. Click Ok
  11. Click Apply
When you now save your project, it will be exported automatically!
You have done it! I hope this guide helped you. Have a good day!