Export and Import Resources
Use this workflow when content definitions should be reviewed, committed, and moved without depending on the UI.
ldev resource is one of the main differentiators of the CLI.
What you can manage as files
- journal structures
- journal templates
- application display templates
- fragments
1. Discover what exists
ldev portal inventory structures --site /global --json
ldev portal inventory templates --site /global --jsonStart with discovery so you know the exact site, key, and object you are exporting.
2. Export from the portal
Export one structure:
ldev resource export-structure --site /global --key 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 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:
ldev resource export-adts --site /global
ldev resource export-fragments --site /global3. Review the files locally
The exported files live in the configured resource paths in your repo. Review them like any other code change.
4. Import back safely
Validate first:
ldev resource import-structures --check-only
ldev resource import-templates --check-onlyApply when ready:
ldev resource import-structures
ldev resource import-templatesIf you want to apply the local directory contents directly:
ldev resource import-templates --apply
ldev resource import-structures --applyReal example:
{
"mode": "single-site",
"site": "/global",
"processed": 1,
"failed": 0,
"failures": []
}Use 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.ftl5. Verify
ldev portal inventory structures --site /global --json
ldev portal inventory page --url /home --jsonThe end state is a resource change that is visible in Git and reproducible without manual clicking.