๐ Moqui Gradle Tasks Documentation

Table of contents
- ๐งน Clean Tasks
- ๐ฆ Development Tasks
- ๐ง Runtime Setup
- ๐ Run & Load Tasks
- ๐พ Save & Reload Database
- ๐ข Deploy Tasks
- ๐งฉ Component Tasks
- ๐ ๏ธ Utility Methods
- createComponentZip(File compDir)
- checkRuntimeDirAndDefaults(String locType)
- loadComponentSet(String setName, ...)
- findComponentDirs()
- parseAddons() / parseMyaddons() / parseComponent(project)
- getComponentTop(locationType)
- getComponent(...)
- downloadComponent(...)
- checkComponentDependencies(...)
- checkAllComponentDependencies(locationType)
- makeVersionDetailFiles()
- getVersionDetailMap(File gitDir)
- cleanVersionDetailFiles()
- ๐ Elasticsearch/OpenSearch Tasks
- ๐ Combined Tasks

โ To run any command, use:
./gradlew [command]
then press โต.
๐งน Clean Tasks
clean
Command:
./gradlew clean
Description: Deletes the WAR file, execution temp directory,
wartemp
folder, and version detail files.
cleanTempDir
Command:
./gradlew cleanTempDir
Description: Deletes only the execution temp directory.
cleanDb
Command:
./gradlew cleanDb
Description: Deletes runtime database files and transaction logs. Also cleans Elasticsearch/OpenSearch data and logs.
cleanLog
Command:
./gradlew cleanLog
Description: Deletes all log files under the runtime log directory.
cleanSessions
Command:
./gradlew cleanSessions
Description: Deletes all files in the runtime sessions directory.
cleanLoadSave
Command:
./gradlew cleanLoadSave
Description: Deletes saved snapshot
.zip
files (e.g.,SaveH2.zip
,SaveElasticSearch.zip
).
cleanPlusRuntime
Command:
./gradlew cleanPlusRuntime
Description: Deletes the runtime extension ("plus") directory or file.
cleanOther
Command:
./gradlew cleanOther
Description: Deletes misc temp/metadata files like
.DS_Store
,*.rej
, and backups.
cleanAll
Command:
./gradlew cleanAll
Description: Runs all cleaning tasks including
clean
,cleanDb
,cleanLog
, and more.
๐ฆ Development Tasks
setupIntellij
Command:
./gradlew setupIntellij
Description: Sets up IntelliJ's XML catalog for XSD schema autocompletion.
๐ง Runtime Setup
getRuntime
Command:
./gradlew getRuntime
Description: Downloads the
runtime
directory and installs components frommyaddons.xml
.
checkRuntime
Command:
./gradlew checkRuntime
Description: Verifies
runtime/
exists, fails with a clear error if not.
๐ Run & Load Tasks
run
Command:
./gradlew run
Description: Starts Moqui in development mode using
moqui-dev.conf
.
runProduction
Command:
./gradlew runProduction
Description: Starts Moqui in production mode using
moqui-production.conf
.
load
Command:
./gradlew load -Ptypes=seed,install
Description: Loads data into the runtime. Defaults to all types if
-Ptypes
is omitted.
loadSeed
Command:
./gradlew loadSeed
Description: Loads only
seed
data (used for minimal production setup).
loadSeedInitial
Command:
./gradlew loadSeedInitial
Description: Loads
seed
andseed-initial
data types for bootstrapping.
loadProduction
Command:
./gradlew loadProduction
Description: Loads
seed
,seed-initial
, andinstall
data for a production-ready setup.
๐พ Save & Reload Database
saveDb
Command:
./gradlew saveDb
Description: Saves the current state of databases (Derby, H2, OrientDB, OpenSearch, ElasticSearch).
loadSave
Command:
./gradlew loadSave
Description: Cleans everything, runs
load
, and saves DB snapshotsโlike a fresh image.
reloadSave
Command:
./gradlew reloadSave
Description: Cleans DBs, logs, and sessions, then restores saved
.zip
snapshots.
๐ข Deploy Tasks
deployTomcat
Command:
./gradlew deployTomcat
Description: Deploys
moqui.war
asROOT.war
to Tomcat, replacing existing files.
plusRuntimeWarTemp
Command:
./gradlew plusRuntimeWarTemp
Description: Prepares an exploded WAR in
wartemp
with embedded runtime and extra jars.
addRuntime
Command:
./gradlew addRuntime
Description: Creates
moqui-plus-runtime.war
combiningmoqui.war
and the runtime directory.
addRuntimeTomcat
Command:
./gradlew addRuntimeTomcat
Description: Builds
moqui-plus-runtime.war
and deploys to Tomcat.
๐งฉ Component Tasks
getDefaults
Command:
./gradlew getDefaults -Pcomponent=MyComponent [-PlocationType=git|current|release|binary]
Description: Retrieves a component and dependencies using the given location type.
getComponent
Command:
./gradlew getComponent -Pcomponent=MyComponent [-PlocationType=git|current|release|binary]
Description: Same as
getDefaults
, with support for dependencies.
createComponent
Command:
./gradlew createComponent -Pcomponent=new_component_name [-PlocationType=git|current]
Description: Creates a new Moqui component using the starter template.
getCurrent
Command:
./gradlew getCurrent -Pcomponent=MyComponent
Description: Retrieves the current archive of a component and dependencies.
getRelease
Command:
./gradlew getRelease -Pcomponent=MyComponent
Description: Downloads the latest release of a component and its dependencies.
getBinary
Command:
./gradlew getBinary -Pcomponent=MyComponent
Description: Fetches the binary archive of a component and dependencies.
getGit
Command:
./gradlew getGit -Pcomponent=MyComponent
Description: Clones the Git repo of a component and its dependencies.
getDepends
Command:
./gradlew getDepends [-PlocationType=git|current]
Description: Gets all dependencies for every component in
runtime/component
.
getComponentSet
Command:
./gradlew getComponentSet -PcomponentSet=mySetName [-PlocationType=git|current]
Description: Downloads all components in a set and their dependencies.
zipComponents
Command:
./gradlew zipComponents
Description: Zips all components under
runtime/component
.
zipComponent
Command:
./gradlew zipComponent -Pcomponent=MyComponent
Description: Zips a specific component under
runtime/component
.
๐ ๏ธ Utility Methods
These aren't Gradle tasks but internal methods you can use when extending the build system.
createComponentZip(File compDir)
- Purpose: Zips a component directory, excluding common build/temp files.
checkRuntimeDirAndDefaults(String locType)
- Purpose: Ensures
runtime/
exists and downloads default components frommyaddons.xml
.
loadComponentSet(String setName, ...)
- Purpose: Loads all components in a
component-set
, with support for nesting.
findComponentDirs()
- Purpose: Returns all valid component directories under
runtime/component
.
parseAddons()
/ parseMyaddons()
/ parseComponent(project)
- Purpose: Parses
addons.xml
,myaddons.xml
, orcomponent.xml
.
getComponentTop(locationType)
- Purpose: Fetches a component using a location type and its dependencies.
getComponent(...)
- Purpose: Downloads a component and resolves its dependencies.
downloadComponent(...)
- Purpose: Downloads/clones a component depending on the location type.
checkComponentDependencies(...)
- Purpose: Ensures all
<depends-on>
components are available and downloaded.
checkAllComponentDependencies(locationType)
- Purpose: Validates dependencies for all components under
runtime/component
.
makeVersionDetailFiles()
- Purpose: Creates
version.json
files in the framework, runtime, and Git-enabled components.
getVersionDetailMap(File gitDir)
- Purpose: Uses Git metadata to build version information.
cleanVersionDetailFiles()
- Purpose: Removes
version.json
files from all relevant directories.
๐ Elasticsearch/OpenSearch Tasks
downloadOpenSearch
Command:
./gradlew downloadOpenSearch
Description: Downloads and unpacks OpenSearch for the current OS.
downloadElasticSearch
Command:
./gradlew downloadElasticSearch
Description: Downloads and unpacks Elasticsearch OSS for the current OS.
startElasticSearch
Command:
./gradlew startElasticSearch
Description: Starts OpenSearch or Elasticsearch in daemon mode and saves PID.
stopElasticSearch
Command:
./gradlew stopElasticSearch
Description: Stops a running OpenSearch or Elasticsearch process using its PID.
๐ Combined Tasks
cleanPullLoad
Command:
./gradlew stopElasticSearch
Description: Runs
cleanAll
,gitPullAll
, andload
.
cleanPullTest
Command:
./gradlew cleanPullTest
Description: Runs
cleanAll
,gitPullAll
,load
, and all test tasks.
cleanPullCompTest
Command:
./gradlew cleanPullCompTest
Description: Same as
cleanPullTest
, but only component-specific test tasks.
compTest
Command:
./gradlew compTest
Description: Dynamically runs component test tasks from
getComponentTestTasks()
.
In this series, i will tell you everything about moqui and how to utilize it to develop high quality, enterprise grade applications, so be hit that follow button to get notified for upcoming blogs.
Thanks and Regards,
Aashutosh Soni
Ashutosh7i.dev
Subscribe to my newsletter
Read articles from Aashutosh Soni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Aashutosh Soni
Aashutosh Soni
Hello, I'm Aashutosh Soni ๐, a passionate Full-Stack Developer from India ๐ฎ๐ณ. I specialize in MERN stack development and have experience in JavaScript, PHP, and C++. I'm also an ML&IOT enthusiast ๐ค, a winner of WittyHacks 3.0, Techacks 4.0, JugaadHacks 2024, Peerlist AI Hacks 2024 ๐top-10 at Hack This Fall 4.0 and an Alpha MLSA member. I enjoy tinkering with electronic devices ๐, creating videos ๐ฅ, and editing graphics ๐จ. Let's connect and talk about all things tech! ๐