Skip to content

Instantly share code, notes, and snippets.

@gastaldi
Created June 3, 2011 14:16
Show Gist options
  • Save gastaldi/1006403 to your computer and use it in GitHub Desktop.
Save gastaldi/1006403 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
03/06/2011 01:12:07
Modeshape ANT script for unsigning jars
This script must be run before assembly:single. Check MODE-1081
George Gastaldi
====================================================================== -->
<project name="modeshape-unsignedjars" default="default">
<description>
Unsigns needed jars for JBoss AS 6
</description>
<!-- =================================
target: default
================================= -->
<target name="default" description="description">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<for param="file">
<path>
<fileset dir="modeshape-jbossas-service/target/distribution/modeshape-services-jar-content">
<include name="common-3.3.0-v20070426.jar" />
<include name="contenttype-3.2.100-v20070319.jar" />
<include name="core-3.3.0-v_771.jar" />
<include name="expressions-3.3.0-v20070606-0010.jar" />
<include name="jobs-3.3.0-v20070423.jar" />
<include name="osgi-3.3.0-v20070530.jar" />
<include name="preferences-3.2.100-v20070522.jar" />
<include name="registry-3.3.0-v20070522.jar" />
<include name="resources-3.3.0-v20070604.jar" />
<include name="runtime-3.3.100-v20070530.jar" />
</fileset>
</path>
<sequential>
<antcall target="unsignjar">
<param name="jar" value="@{file}" />
</antcall>
</sequential>
</for>
</target>
<macrodef name="unsignjar">
<attribute name="jar" />
<sequential>
<!-- Remove any existing signatures from a JAR file. -->
<tempfile prefix="usignjar-" destdir="${java.io.tmpdir}" property="temp.file" />
<echo message="Removing signatures from JAR: @{jar}" />
<mkdir dir="${temp.file}" />
<unjar src="@{jar}" dest="${temp.file}">
<patternset>
<include name="**" />
<exclude name="META-INF/*.SF" />
<exclude name="META-INF/*.DSA" />
<exclude name="META-INF/*.RSA" />
</patternset>
</unjar>
<delete file="@{jar}" failonerror="true" />
<!-- Touch it in case the file didn't have a manifest.
Otherwise the JAR task below will fail if the manifest
file doesn't exist. -->
<mkdir dir="${temp.file}/META-INF" />
<touch file="${temp.file}/META-INF/MANIFEST.MF" />
<jar destfile="@{jar}" basedir="${temp.file}" includes="**" manifest="${temp.file}/META-INF/MANIFEST.MF" />
<delete dir="${temp.file}" failonerror="true" />
</sequential>
</macrodef>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment