|<<Ant Taskdef||Home Print Layout||SDK>>|
one-jar-appgen-0.97.jar/one-jar-$project$.jarfile and it has the following directory structure: The key elements of this template are:
path/testin a package called
$project$will expand to
$package$will expand to
foo.bar. The output files will be written under
The template build.xml file starts out as:
<?xml version="1.0" encoding="UTF-8"?> <project name="one-jar-$project$" basedir="." default="build">and is transformed to:
<?xml version="1.0" encoding="UTF-8"?> <project name="one-jar-test" basedir="." default="build">etc. The end result is a new project which builds two One-JAR archives:
com.simontuffs.onejar.test.Testable, which can be used by the
$package$.test.$project$Suiteclass to run a JUnit test suite. This is demonstrated by the
junit.$project$target in the build.xml file.
one-jar-$project$.jaras a third argument to the program it will be used for template expansion instead of the built-in template. The best way to roll-your-own template is to first extract and unpack the
one-jar-$project$.jarfile from inside the one-jar-appgen jar. You can then build it in-place (it does build itself) using Ant, and start adding in your own new files (with the tokens
$packagein the appropriate places in file-content, filenames and directories. Once the appgen results are what you want, running with the extra third argument, you can repack the
one-jar-appgenjar file with the new template, and start using it (and sending it to your customers).
one-jar-appgenjar file and look at the Appgen source code which is under main.jar/src in the distribution. There is no significant magic there, but there is some logic which might not be obvious surrounding camel-case and conversion of '-' to '_' in various places that you might wish to modify as you "roll-your-own appgen" too.