-
-
Save tcurdt/9275523 to your computer and use it in GitHub Desktop.
<target name="package" depends="jar"> | |
<taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask"/> | |
<deb destfile="${build.dir}/${ant.project.name}.deb" verbose="true"> | |
<control> | |
<package>(no default)</package> | |
<version>(no default)</version> | |
<section>(default 'misc')</section> | |
<priority>(default 'low')</priority> | |
<architecture>(default 'all')</architecture> | |
<maintainer>(no default)</maintainer> | |
<pre-inst src="${basedir}/someshell.sh"/> | |
<pre-rm src="${basedir}/someshell.sh"/> | |
<post-inst src="${basedir}/someshell.sh"/> | |
<post-rm src="${basedir}/someshell.sh"/> | |
</control> | |
<data> | |
... see maven | |
</data> | |
</deb> | |
</target> |
<plugin> | |
<artifactId>jdeb</artifactId> | |
<groupId>org.vafer</groupId> | |
<version>2.0</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>jdeb</goal> | |
</goals> | |
<configuration> | |
<verbose>true</verbose> | |
<token open="[[" close="]]"/> | |
<control> | |
<package>(default from pom)</package> | |
<version>(default from pom)</version> | |
<section>(default 'misc')</section> | |
<priority>(default 'low')</priority> | |
<architecture>(default 'all')</architecture> | |
<maintainer>(default from pom)</maintainer> | |
<pre-inst src="${basedir}/someshell.sh"/> | |
<pre-rm src="${basedir}/someshell.sh"/> | |
<post-inst src="${basedir}/someshell.sh"/> | |
<post-rm src="${basedir}/someshell.sh"/> | |
</control> | |
<!-- defaults: | |
dir: own=root:root mod=750 | |
file: own=root:root mod=640 token=no compress=no | |
--> | |
<data> | |
<dir> | |
<dir> | |
<name>usr</name> | |
<own>root:root</own> | |
<mod>755</mod> | |
<dir> | |
<name>bin</bin> | |
<file> | |
<name>test</test> | |
<own>root:root</own> | |
<mod>755</mod> | |
<src>${basedir}/someshell.sh</src> | |
<token>yes|no</token> | |
</file> | |
<file> | |
<name>test-as-link</test> | |
<own>root:root</own> | |
<mod>755</mod> | |
<type>symbolic</type> | |
<target>test</target> | |
</file> | |
</dir> | |
<dir> | |
<name>lib</bin> | |
<file> | |
<name>${project.build.finalName}.jar</test> | |
<mod>755</mod> | |
<src>${project.build.directory}/${project.build.finalName}.jar</src> | |
</file> | |
<file> | |
<name>${project.build.finalName}.man.gz</test> | |
<mod>755</mod> | |
<src>somepath</src> | |
<compress>gzip</compress> | |
</file> | |
</dir> | |
<dir> | |
<name>doc</bin> | |
<src>${basedir}/docs</src> | |
<own>auto</own> | |
<mod>auto</mod> | |
<dir> | |
<name>examples</bin> | |
<src>${basedir}/examples.tgz</src> | |
<own>auto</own> | |
<mod>auto</mod> | |
</dir> | |
</dir> | |
</dir> | |
</data> | |
<!-- rules for defaults --> | |
<rules> | |
<match> | |
<src>*.man</src> or <dst>*.man.gz</dst> | |
<file> | |
<own>root:root</own> | |
<mod>640</mod> | |
<token>yes</token> | |
<compress>gzip</compress> | |
</file> | |
<dir> | |
<own>tcurdt:tcurdt</own> | |
</dir> | |
</match> | |
</rules> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> |
Hi,
I created a small experimental project:
https://github.com/michael-schnell/experimental-jaxb-ant
The following file loads the XML and executes an ANT copy task:
https://github.com/michael-schnell/experimental-jaxb-ant/blob/master/src/test/java/org/fuin/examples/anttryout/CopyTaskExample.java
When I created it, I dived into the depth of the Ant source and it remembered me why I finally moved to Maven... ;-)
XML "if-else" stuff like this is pretty ugly:
<includesfile name="some-file"/>
<includesfile name="${some-other-file}" if="some-other-file"
The JavaDoc is also odd:
/** Appends excludes to the current list of exclude patterns.*/
public void setExcludes(String excludes) { ... }
(Why is the name "setExcludes" if it means "addExclude"?)
I'm not sure if it makes sense (or even is possible) to clone all of the Ant data structures.
Maybe it's better to define some kind ob subset just keeping the best of it.
Cheers,
Michael
@michael-schnell the problem with external files is the use of ant's file selectors or variable expansions. It would make many things much easier though. Feel free to come up with an example.