lazybones

How do I get Lazybones to process sub-templates?


Playing with Lazybones for the first time. I've put together a simple project which attempts to include a single sub-template.

Here is the project structure:

.
├── build.gradle
├── gradlew
├── gradlew.bat
├── README.md
└── templates
    ├── groovy-lambda
    │   ├── build.gradle
    │   ├── lazybones.groovy
    │   ├── README.md
    │   ├── src
    │   │   ├── main
    │   │   │   ├── groovy
    │   │   │   │   └── .retain
    │   │   │   └── resources
    │   │   │       └── .retain
    │   │   └── test
    │   │       ├── groovy
    │   │       │   └── .retain
    │   │       └── resources
    │   │           └── .retain
    │   └── VERSION
    └── subtmpl-groovy-lambda-main-class
        ├── GroovyLambdaMainClass.groovy
        ├── lazybones.groovy
        └── VERSION

And I'm including the sub-template like so

lazybones {
    template "groovy-lambda" includes "groovy-lambda-main-class"
}

The sub-template gets packaged in the main artefact archive:

.
├── build.gradle
├── .lazybones
│   ├── groovy-lambda-main-class-template-1.0-SNAPSHOT.zip
│   └── stored-params.properties
├── README.md
└── src
    ├── main
    │   ├── groovy
    │   └── resources
    └── test
        ├── groovy
        └── resources

However the sub-template never gets processed at template execution time i.e. the sub-templates lazybones.groovy script doesn't seem to get run.

The whole project is available here on GitHub. To reproduce the issue do:

git@github.com:eddgrant/lazybones-template-aws-groovy-lambda.git
cd lazybones-template-aws-groovy-lambda.git
./gradlew installAllTemplates

cd /tmp
lazybones --verbose create groovy-lambda 1.0-SNAPSHOT groovy-lambda

I'm probably missing something trivial but can't quite figure it out. Most grateful for any pointers.


Solution

  • Everything is working as expected. Sub templates are only used by the lazybones generate command, which in turn works only once you have created a Lazybones-based project.

    The classic example is something like a Grails or Rails project in which you would use the generate command to create new controllers or domain classes.