how do i set the Main-Class attribute of my jar in ant?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Create a manifest:
<manifest file="build/MANIFEST.MF">
<attribute name="Main-Class"
value="foo.FooMain" />
</manifest>
<jar destfile="build/foo.jar"
manifest="build/MANIFEST.MF">
<fileset dir="build/classes" />
</jar>
回答2:
You can specify it in the manifest by using the Manifest nested element of the Jar task. Set Main-Class
to the required class.