ant jar's mainclass

2020-08-09 17:30发布

how do i set the Main-Class attribute of my jar in ant?

标签: java ant jar
2条回答
地球回转人心会变
2楼-- · 2020-08-09 17:44

You can specify it in the manifest by using the Manifest nested element of the Jar task. Set Main-Class to the required class.

查看更多
相关推荐>>
3楼-- · 2020-08-09 18:11

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>
查看更多
登录 后发表回答