Export and Import Resources
This is the flagship ldev workflow.
In Liferay, structures, templates, ADTs and fragments live in the admin UI. There is no clean, scriptable path to export them, review the change in Git, and import them back. ldev resource is that path.
Use this workflow when content definitions should be reviewed, committed and moved without depending on the UI.
What you can manage as files
- journal structures
- journal templates
- application display templates (ADTs)
- fragments
1. Discover what exists
ldev portal inventory structures --site /global --with-templates --json
ldev portal inventory templates --site /global --jsonStart with discovery so you know the exact site, key and object you are exporting. --with-templates is the right starting point for any structure/template work — it returns structures enriched with their associated templates in one call.
2. Export from the portal
Export one structure:
ldev resource export-structure --site /global --structure MY_STRUCTUREExport all structures and templates:
ldev resource export-structures --site /global
ldev resource export-templates --site /globalExport everything in one pass:
ldev resource export-structures --all-sites
ldev resource export-templates --all-sites
ldev resource export-adts --all-sites
ldev resource export-fragments --all-sitesReal output examples:
EXPORTED mode=all-sites scanned=2 count=1
EXPORTED mode=all-sites scanned=2 exported=1 failed=0 dir=.../liferay/resources/journal/templates
collections=0 fragments=0 scanned=2 mode=all-sites dir=.../liferay/fragmentsExport ADTs and fragments scoped to a site:
ldev resource export-adts --site /global
ldev resource export-fragments --site /global3. Review the files locally
Exported files live under the configured resource paths in your repo. Review them like any other code change. Diff, commit, branch, PR — all the things the UI never let you do.
4. Preview the import
Always preview before mutating:
ldev resource import-structures --check-only
ldev resource import-templates --check-only--check-only reports what would change without writing anything.
5. Apply the import
ldev resource import-structures
ldev resource import-templatesOr apply the local directory contents directly:
ldev resource import-templates --apply
ldev resource import-structures --applyUse the focused commands when you are changing one object only:
ldev resource import-structure --file liferay/resources/journal/structures/global/MY_STRUCTURE.json
ldev resource import-template --file liferay/resources/journal/templates/global/MY_TEMPLATE.ftlWhen a singular template import points at a file inside liferay/resources/journal/templates/<site>/..., ldev infers that <site> folder automatically if you omit --site.
Real output:
{
"mode": "single-site",
"site": "/global",
"processed": 1,
"failed": 0,
"failures": []
}6. Verify with read-after-write
Do not stop at the import success message. Read the resource back and check the page that depends on it:
ldev resource structure --site /global --structure MY_STRUCTURE
ldev portal inventory structures --site /global --with-templates --json
ldev portal inventory page --url /home --jsonThe end state is a resource change that is visible in Git, reproducible from files, and verified by reading the portal back.
When to use migration instead
If the structure change touches fields that already have content (renaming, removing, splitting fields), a plain import is not enough. Use the Resource Migration Pipeline instead — it is the workflow Liferay does not have natively.