๐Ÿ““ Moqui Gradle Tasks Documentation

Aashutosh SoniAashutosh Soni
5 min read

โ†’ 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 from myaddons.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 and seed-initial data types for bootstrapping.

loadProduction

  • Command: ./gradlew loadProduction

  • Description: Loads seed, seed-initial, and install 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 as ROOT.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 combining moqui.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 from myaddons.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, or component.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, and load.

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

0
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! ๐Ÿš€