ant-shade-task
is a wrapper of Apache Maven Shade Plugin (or maven-shade-plugin
) for Ant.
- Use: Java 8 and Apache Ant.
- Build: Java 8 and Apache Maven.
- Build with
mvn clean package
. - Pick
ant-shade-task-0.1-SNAPSHOT.jar
orant-shade-task-0.1-SNAPSHOT-jar-with-dependencies.jar
from thetarget
directory and copy it to elsewhere. - Register the picked up JAR file in
build.xml
:
<taskdef
classpath="ant-shade-task-0.1-SNAPSHOT-jar-with-dependencies.jar"
resource="org/apache/tools/ant/taskdefs/shade.properties"
/>
- Apply (an adapted example taken from the Maven Shade Plugin Relocating Classes example):
<shade jar="foo-bar.jar" uberJar="foo-bar-shaded.jar">
<relocation pattern="org.codehaus.plexus.util" shadedPattern="org.shaded.plexus.util">
<exclude value="org.codehaus.plexus.util.xml.Xpp3Dom"/>
<exclude value="org.codehaus.plexus.util.xml.pull.*"/>
</relocation>
</shade>
The snippet above is an Ant adaptation of the following Maven Shade Plugin configuration snippet:
<relocations>
<relocation>
<pattern>org.codehaus.plexus.util</pattern>
<shadedPattern>org.shaded.plexus.util</shadedPattern>
<excludes>
<exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
<exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
</excludes>
</relocation>
</relocations>
- Only
<relocations>
are exposed through the<shade>
task so far.
Nothing tagged yet.
ant-shade-task-0.1-SNAPSHOT.jar
does not include any dependencies and the dependencies should be picked up either manually or usingant-shade-task-0.1-SNAPSHOT-jar-with-dependencies.jar
that's currently large (about 8.7MB).- Not a part of the standard Apache Ant taskdef library, but occupies the
org.apache.tools.ant.taskdefs.Shade
class, and probably should be moved to another non-Apache package.