Page tree
Skip to end of metadata
Go to start of metadata

The version cleaner module provides commands to remove old or duplicated versions from your version store. Which versions are selected for removal can be configured through voters.

Analyzing and removing unneeded versions can take a lot of time, the version cleanup command can be configured to examine a set number of versions (actually nodes in the version workspace) and then stop. The next run of the version cleanup command will resume from the node last analyzed.

The version cleaner can be configured to select which versions are deleted or retained. 


Maven is the easiest way to install the module. Add the following dependency to your bundle:



1.5Magnolia 5.5
1.4Magnolia 5.5+
1.3Magnolia 5.5+
1.2Magnolia 5.5


The module provides a set of commands for removing selected versions from the version history. 

Which versions are selected for deletion are configurable through voters. You can define complex conditions to identify if a version should be deleted.

Cleanup Commands

The cleanup commands can be found in the version cleaner catalog: /module/versioncleaner/commands/cleanup


Remove unneeded versions according to its configuration.


Remove all versions found except root and leaf versions.

Unlike cleanVersions, cleanAllVersions does not require possibly complicated configuration.

The cleanVersions and cleanAllVersions commands can be configured with the following parameters when invoked:


true or false (the default)

Does a "dry run", going through the selected versions but without deleting or modifying them.


true or false (the default)

If true, will save an export of each version to be deleted to the specified archiveDir.

NOTE: using this option may generate many files. Be sure you have sufficient space to store the archive versions.


Directory for storing archived versions and cleaning run history. 

Defaults to: ${magnolia.cleanup.dir} if specified or ${magnolia.repositories.home}.

NOTE: Magnolia must have read and write permissions for the directory.


The maximum number of version nodes that will be checked during a run. 

If set to a number less than 0, all version nodes will be checked.

These parameters can also be set as properties in the command configuration, at /module/versioncleaner/commands/cleanup/cleanVersions or /module/versioncleaner/commands/cleanup/cleanAllVersions.

Diagnostic Commands

The diagnostic commands can be found in the version cleaner catalog: /module/versioncleaner/commands/diagnostic


Locate corrupted versions in the version workspace.

A version is corrupt if it: 

  • has no root version
  • has multiple root versions
  • the root version identified by name differs from the root version returned by the JCR API

Configuring Cleanup

The versions selected for removal by the cleanVersions command are controlled by Voters. The cleanVersions command has two sets of voters: 

  • voters to determine if the versions of a node should be checked
  • voters to select specific versions of a node for deletion

Since there may be many, many more versions than nodes, the cleanVersions command first checks if versions of each node should be cleaned up before checking if each each version should be retained or deleted. 


  • This module is at INCUBATOR level.