Kotlin Application Template
Context
After creating your Template, you can customize it. This use case shows how to customize your Template to create Kotlin applications. You need to know the groupId
to automatically create the folder structure in your application.
There are configurations you can customize; to do that, you need to get information from those who will use your Template to create applications.
For more details, see the template.yaml
structure section.
See the steps below:
Prerequisite
- You need a Template.
Step 1. Customize your Template
- Edit the template.yaml file and add a new input called group_id and their information:
name: template-example #Template name
description: Template for Kotlin applications #Template Description
types:
- app-template #app-template, env Template or both
inputs: #input variables expected by the Template
- label: project name #input field label that will be presented to the user
type: text #input type
name: project_name #input name
default: project-name #default value if you do not fill the field
- label: "Enter the groupId:"
type: text
name: "group_id"
default: "com.stackspot"
You must fill in the above information when you create an application based on this Template.
For more information about the yaml
structure check out the documentation.
- The project_name is automatically passed by the application name in the
stk-legacy create app <project_name>
.
Step 2. Test the customization
Test the Template locally before uploading to a repository. Run the command:
stk-legacy create app <application-name> --template-path <path_template_local>
The app was created on your computer.
Step 3. Upload the Template to your hosting platform
If your app was created on your local machine, upload your modifications to a web hosting platform to make your Template accessible.
Go to the template folder and run:
git add .
Then:
git commit -m “message”
And finish:
git push origin main
That's it!
Was this page helpful?