Development and projects
Development and projects
How are applications put together built and delivered
The XP project structure is based on the Maven approach.
Below is is an extensive version of a project structure, listing all standard folders and files that can be used
sample-project/ build.gradle gradle.properties gradlew gradlew.bat settings.gradle src/ test/ java/ main/ java/ resources/ admin/ widgets/ tools/ application.svg application.xml assets/ error/ i18n/ main.js services/ tasks/ site/ content-types/ layouts/ mixins/ pages/ parts/ processors/ x-data/ site.xml webapp/ webapp.js
Every file and folder has a specific function and purpose as described below:
main file used by the Build system.
Standard settings for XP apps
- gradlew / gradlew.bat
The Gradle wrapper file. Downloads and runs Gradle without having to install it manually.
Mandatory gradle file to boostrap the build process
Optional folder where you place java code that might be included directly in the project - Maven style.
Optional folder where you place test code - Maven style.
Non-Java files. The majority of XP project code goes here,
Admin tools are defined here. Tools are administrative apps listed in the admin console menu.
Admin widgets are essentially user interface components that can be embedded within other admin tools.
Application icon in SVG format.
The XML file contains basic application settings. Currently a description.
The application’s error handler
Main controller is executed every time an app is started.
Contains Http services controllers
Short for internationalization, this folder contains app localization files
Contains task controller for running asynchronous jobs.
Contains site configuration schema and declares that the app can be added to sites
Content type definition files.
For post processing of HTML from pages.
Layout controllers are placed here.
Reusable schemas are placed here.
Page controllers are placed here.
Part controllers are placed here.
<<../cms/x-data#, eXtra data schemas.
The Webapp controller file
Libraries are structurally similar to applications, with the difference that a library is designed to be installed and run on it’s own. However, a library can be included in an application (or many) to provide functionality to that app.
The process of setting up and building libraries is similar to applications. To build a library we recommend using the library project template.
Once a library has been built, the output will be a .jar file, just like an application. However, libraries will have small differences in application metadata.
To add a library in an application, simply update the applications