Integrating Java hash signing CSP with ANT

Add the following code snippet to your build.xml file.

<project name="vanilla" default="dist" basedir=".">
sample vanilla application
<!-- set global properties for this build -->
<property name="name" value="vanilla"/>
<property name="src" location="src/main/java" />
<property name="build" location="ant-build" />
<property name="dist" location="${build}" />
<property name="version" value="1.0" />
<property environment="env"/>
<property name="jarfilename" value="${name}-${version}.jar" />
<property name="jarsigner" value="${env.JAVA_HOME}/bin/jarsigner.exe" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" />
<target name="dist" depends="compile" description="generate the distribution">
<buildnumber />
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib" />
<!-- Put everything in ${build} into the MyApplication-${version}.${build.number}.jar -->
<jar destfile="${dist}/lib/${jarfilename}" basedir="${build}" />
<target name="sign" depends="dist" description="sign the jar using jarsigner">
<exec executable="${jarsigner}">
<arg line="-J-DcspPropertiesFile=C:\users\anshuman_mor\desktop\testing\java\ -keystore NONE -storetype SAS -storepass changeit -providerClass ${dist}/lib/${jarfilename} Ft3_27072018,${jarfilename}" />
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />

See jarsigner and CSP properties for more information on these integration tools.

We use cookies to ensure that we give you the best experience on our website. By using this site, you agree to the Terms of Service.