Working with skeletons of project

EasyAnt comes with a module named skeleton that allows you to create or install project skeletons. This could be pretty useful to quickstart a project.

By default, this module works in interactive mode, which means that easyant will ask you questions for every required property. But you can still give parameters on the command line using -Dproperty.
Interactive mode can be disabled by setting skeleton.interactive.mode=false.

How to create a new project using a project skeleton ?

Selecting from a list of all available skeletons

Since easyant 0.8 skeleton plugin provides a target allowing to chose a skeleton from a list. This target is named ":select"
Example:
> easyant skeleton:select
skeleton-select:
[echo] Choose a skeleton in the following list:
[ea:searchmodule] 0: std-java-webapplication v0.1 (Skeleton for creating standard java web application)
[ea:searchmodule] 1: std-ant-plugin v0.1 (Skeleton for creating ant based plugin for easyant)
[ea:searchmodule] 2: std-java-application v0.1 (Skeleton for creating standard java application)
[ea:searchmodule] 3: std-skeleton v0.1 (Emtpy skeleton structure)
[ea:searchmodule] Choose a number: (0, 1, 2, 3)
Then easyant will prompt you to set information related to the generated project like organisation name, module name revision.
    [input] The path where the skeleton project will be unzipped [.]

[input] Organisation name of YOUR project
org.mycompany
[input] Module name of YOUR project
myProject
[input] Revision number of YOUR project [0.1]

Generate a project structure using skeleton's properties

EasyAnt also provides an alternative way to use skeletons. It can be used by settings properties.
When runnning in interactive mode (default behavior) easyant will prompt you to set many properties to define which skeleton should be used and some properties related to the generated project (like organisation name, module name, and revision).

If you prefer to use it in that way you should use ":generate" target.
Example if your skeleton module is imported as "skeleton", you should use :

> easyant skeleton:generate
[input] Organisation name of the skeleton project
org.apache.easyant.skeletons
[input] Module name of the skeleton project
std-java-skeleton
[input] Revision number of the skeleton project
0.1
[input] The path where the skeleton project will be unzipped [.]
.
[input] Organization name of YOUR project
org.mycompany
[input] Module name of YOUR project
myProject
[input] Revision number of YOUR project [0.1]
0.1
After a few seconds you get your future project ready.

How can i create my own skeleton ?

Ask easyant to create a new skeleton by using ":newskeleton" target
> easyant skeleton:newskeleton
Then easyant will prompt you to set a few information like the skeleton organisation name, skeleton name, and the future revision.
    [input] The path where the skeleton project will be unzipped [.]
[input] Organisation name of YOUR project [org.apache.easyant.skeletons]

[input] Module name of YOUR project
myskeleton
[input] Revision number of YOUR project [0.1]
After a few second you get an ready to use structure for your skeleton.
.
|-- module.ivy
`-- src
|-- main
| `-- resources
| `-- module.ivy.tpl
`-- test
`-- antunit
`-- myskeleton-test.xml
The module.ivy is the module descriptor of your skeleton.
src/main/resources is the content of your skeleton.

If you need to use pattern replacement, you must add a .tpl at the end of your file.

Example :
Supposing we want to create a project called "std-java-skeleton".

By default easyant comes with 3 replacement patterns:
Every .tpl file that contains one of those 3 patterns between @ delimiter will be replaced when extracting the skeleton.
.
|-- module.ivy
`-- src
|-- main
| `-- resources
| |-- module.ivy.tpl
| `-- src
| |-- main
| | `-- resources
| | `-- temp-plugin.ant.tpl
| `-- test
| `-- antunit
| `-- temp-plugin-test.xml.tpl
`-- test
`-- antunit
Optionnaly you can add a post install script that will be run after unpacking the skeleton. This is pretty usefull to enhance skeleton behavior and do some post processing.
This post install script is named skeleton.postinstall.ant (but can be configured through "skeleton.postinstall.script" property).

List of existing project skeletons

Here you can find a list of skeletons provided by easyant distribution.
Organisation Module Revision Description
org.apache.easyant.skeletons std-java-application 0.1 Project skeleton used to create standard java application
org.apache.easyant.skeletons std-java-webapplication 0.1 Project skeleton used to create standard java web application
org.apache.easyant.skeletons std-ant-plugin 0.1 Project skeleton used to create easyant plugins
org.apache.easyant.skeletons std-skeleton 0.1 Project skeleton used to create new skeletons