Development and projects
Contents
How are applications and libraries put together built and delivered
Project structure
The XP project structure is based on the Maven project structure.
Below 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/
idprovider/
main.js
services/
tasks/
site/
content-types/
layouts/
mixins/
pages/
parts/
processors/
x-data/
site.xml
webapp/
Every file and folder has a specific function and purpose as described below:
- build.gradle
-
Gradle script used by the Build system for building the application or library.
- gradle.properties
-
Build properties
- gradlew | gradlew.bat
-
Gradle wrapper file. Downloads and runs Gradle without having to install it manually.
- settings.gradle
-
Mandatory gradle file to boostrap the build process
- src/main/java/
-
Optional folder where you place Java code that might be included directly in the project.
- src/test/java/
-
Optional folder where you place Java test code.
- src/main/resources/
-
Non-Java files. The majority of XP project code goes here,
- admin/tools/
-
Admin tools are defined here. Tools are administrative apps listed in the admin console menu.
- admin/widgets/
-
Admin widgets are essentially user interface components that can be embedded within other admin tools.
- application.svg
-
Application icon in SVG format.
- application.xml
-
Application information in XML format.
- assets/
-
Publicly available static assets such as css and javascript. Assets are served by the asset service.
- error/error.js
-
The application’s error handler
- main.js
-
Main controller executed every time an app is started.
- services/
-
Contains Http services controllers
- i18n/
-
Short for internationalization, this folder contains app localization files
- idprovider/
-
ID Providers application files are placed her
- tasks/
-
Contains task controller for running asynchronous jobs.
- site/site.xml
-
Contains site configuration schema and declares that the app can be added to sites
- site/content-types/
-
Content type definition files.
- site/processors/
-
For post processing of HTML from pages.
- site/layouts/
-
Layout controllers are placed here.
- site/mixins/
-
Reusable schemas are placed here.
- site/pages/
-
Page controllers are placed here.
- site/parts/
-
Part controllers are placed here.
- site/x-data/
-
eXtra data schemas.
- webapp/webapp.js
-
The Webapp controller file