java 自动生成jar,如何在Eclipse Java项目中自动生成.jar文件

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.

2hxBv.png

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.

dcm1H.png

GrOBz.png

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值