Integrating Java hash signing CSP with ANT

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

xml
<project name="vanilla" default="dist" basedir=".">
<description>
sample vanilla application
</description>
<!-- 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>
<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" />
</target>
<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>
<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\JAVA_CSP.properties -keystore NONE -storetype SAS -storepass changeit -providerClass com.symantec.sas.csp.CSPProvider ${dist}/lib/${jarfilename} Ft3_27072018,${jarfilename}" />
</exec>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
</project>

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.