I have an Eclipse Java project. It contains a folder named "dist". In that folder is a .jar file.
How can I set things up in this project to make sure this .jar file is updated any time one of the .java files in the project has been re-compiled?
Thanks.
解决方案
Create an Ant file and tell Eclipse to build it. There are only two steps and each is easy with the step-by-step instructions below.
Step 1
Create a build.xml file and add to package explorer:
Eclipse should looks something like the screenshot below. Note the Ant icon on build.xml.
Step 2
Right-click on the root node in the project.
- Select Properties
- Select Builders
- Select New
- Select Ant Build
- In the Main tab, complete the path to the build.xml file in the bin folder.
Check the Output
The Eclipse output window (named Console) should show the following after a build:
Buildfile: /home//src/Test/build.xml
CreateJar:
[jar] Building jar: /home//src/Test/Test.jar
BUILD SUCCESSFUL
Total time: 152 milliseconds