I have written the following ant target:
<target name="approval_request_parser_compile">
<taskdef resource="genjar.properties" classpath="GenJar.jar"/>
<genjar jarfile="prod/lib/approvalRequestParser.jar">
<class>
<fileset dir=".">
<include name="com.bet.Check.class"/>
<include name="com.bet.Approve.class"/>
<include name="com.bet.CheckText.class"/>
<include name="com.bet.Request.class"/>
<include name="com.bet.ApprovalRequestParser.class"/> #contains the main method
</fileset>
</class>
<classpath>
<fileset dir="lib">
<include name="*.jar" />
</fileset>
<pathelement path="."/>
</classpath>
</genjar>
</target>
The jar is created successfully, but when I go to /prod/lib and I type:
java -jar approvalRequestParser.jar
this error is raised:
no main manifest attribute, in approvalRequestParser.jar
Any ideas?
I am not using genjar
but you need to create the manifest file, see an example below
<target name="buildJAR" depends="compile">
<tstamp>
<format property="BUILD.TSTAMP" pattern="MMMM dd yyyy hh:mm:ss" locale="en"/>
</tstamp>
<buildnumber file="build.number"/>
<mkdir dir="classes/META-INF"/>
<echo file="classes/META-INF/version.txt">Version: ${VERSION} (build #: ${build.number}, ${BUILD.TSTAMP})</echo>
<manifest file="classes/META-INF/MANIFEST.MF">
<attribute name="Specification-Title" value="ANY TEXT CAN GO HERE"/>
<attribute name="Specification-Version" value="${VERSION}"/>
<attribute name="Specification-Vendor" value="COMPANY NAME"/>
<attribute name="Implementation-Title" value="WHAT CODE DOES"/>
<attribute name="Implementation-Version" value="${VERSION} (build #: ${build.number}, ${BUILD.TSTAMP})"/>
<attribute name="Implementation-Vendor" value="WHO DOES IT"/>
</manifest>
<jar destfile="JAR FILE" basedir="classes"
includes="${CORE_CODE}" manifest="classes/META-INF/MANIFEST.MF"/>
</target>
I think you can apply the same for genjar task
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.