.. meta:: :description: Let’s write simple app ‘greet’. This app should contain at least one facet “someone” and one command “greet” in this facet. Simple greet app tutorial =========================== Let's write simple app 'greet'. This app should contain at least one facet "someone" and one command "greet" in this facet. Create app structure ##################### Project structure to create. * greet-app * pom.xml * src * main * groovy * **global.groovy** * someone * **someone.groovy** * resources * **descriptor.json** * assets * **someone-channel-logo.svg** * channel * **channel-type.json** descriptor.json ##################### .. rubric:: /src/main/resources/descriptor.json We need descriptor for the app that defines facets, app identity and other configuration of the app. .. code-block:: javascript { "id": "greet", "version": 0, "facets": [ { "id": "someone", "name": "Greet Someone", "requires": [ "default.default" ], "iconName": "plugin:greet:someone-channel-logo.svg" } ] } As you can see we define app with id = "greet" and version = 0. This app contain one facet with id = "someone". FullFacetId will be "greet.someone" Facet name is "Greet Someone". It requires "default.default" facet. When we add facet "greet.someone" to the channel facet "default.default" will be added with it. Channel with this facet will have **someone-channel-logo.svg** icon from our assets folder. Common pattern is: **"plugin:${appId}:${assetFileName}.svg"** :ref:`app-desc-reference-label` assets ##################### .. rubric:: /src/main/resources/assets We can add .svg icons here to use it in the facet descriptors as channel icons. Use **fill="currentColor"** to inherit channels' tree icon colors. Example: .. code-block:: xml groovy scripts ##################### .. rubric:: /src/main/groovy/global.groovy You can use this file to add command to the all channels in your workspace. If you want it write further implementation in this file and don't create facet specific groovy files. For your custom apps you can combine this file with other facet specific groovy files. .. rubric:: /src/main/groovy/someone/someone.groovy Use this file to implement the "greet.someone" facet scoped business logic. File name can differ with facet name and there are can be many files. But path to the file must match to the pattern "/src/main/groovy/${facetId}/" .. rubric:: implementation .. code-block:: groovy def greet(name) { send "Hello, $name!" } Just add this to your groovy file to define "/greet" command with string "name" parameter. channel types ################## .. rubric:: /src/main/resources/channel This is the place for the channel type descriptors. Skip it for this tutorial. build zip archive to deploy ############################ run "mvn clean assembly:single" to build the app. You can find it in the newly created "target" folder. .. rubric:: pom.xml .. code-block:: xml 4.0.0 0.0.1-SNAPSHOT 2.5.6 UTF-8 11 11 greet-app ${project.artifactId}: Tutorial Greeting App com.example jar org.codehaus.groovy groovy-all ${groovy-all.version} pom maven-assembly-plugin 3.1.1 src posix org.codehaus.gmaven groovy-maven-plugin 2.1.1 Congratulations ############################ You create the greet app for you Leverice workspace. Lets :ref:`deploy-reference-label`!