Automatically Creating Manifest File with Eclipse

2020-03-01 06:34发布

How can I create a Manifest file for a group of JAR file I have already created.

I used Eclipse to create my JAR file.

Is there any better way of creating a JAR file that has a Manifest?

8条回答
一夜七次
2楼-- · 2020-03-01 07:24

With Ant you can use jar task. It has a manifest option to specify all the attributes yo need to include. Something like this:

  <target name="create-my-jar">
     <jar jarfile="foo.jar" basedir="bin/classes">      
        <manifest>
        <attribute name="Class-Path" value="xxx"/>
        <attribute name="Ant-Version" value="${ant.version}"/> 
        <attribute name="Created-By" value="JDK ${java.version} (${java.vendor})"/>
        <attribute name='Specification-Title' value='xxx' />
        <attribute name='Specification-Version' value='xxx' />
        <attribute name='Specification-Vendor' value='xxx' />
        <attribute name='Implementation-Title' value='xxx' />
        <attribute name='Implementation-Version' value='xxx' />
        <attribute name='Implementation-Vendor' value='xxx' />
        <attribute name='Implementation-Vendor-Id' value='xxx' />
        <attribute name='Implementation-Vendor-URL' value='xxx' />
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name='Build-Date' value='xxx'/>
        <attribute name='Build-Time' value='xxx'/>              
        </manifest>
        </jar>
   </target>
查看更多
够拽才男人
3楼-- · 2020-03-01 07:26

Also you can take a look at this documentation, this helped me to solve the issue using the Eclipse wizard.

See Eclipse Documentation

查看更多
登录 后发表回答