Question
- How do I install CRX packages automatically on CRX server startup?
- How can I repackage the crx quickstart jar file to include packages that I would like to install when crx is started for the first time?
Answer, Resolution
Installing Packages Automatically on CRX startup
The CRX application includes a directory named crx-quickstart/repository/install
that can be used for installing CRX packages automatically on CRX application startup. This feature is called the CRX Auto Installer. Packages that are copied to this folder will be installed in alphabetical order.
From CRX2.3 OR Later
Please use directory named <cq_home>/crx-quickstart/install for installing packages automatically on application startup.
Installing Packages on CRX Quickstart Installation
You may also have packages automatically installed when CRX is first installed. This can be done by creating a custom CRX Quickstart jar that will auto install your packages. To do this we must add the package files to the jar file under /static/repository/install/
.
This can be done with the jdk jar command:
jar uf [quickstart jar filename] static/repository/install/[package filename 1] static/repository/install/[package filename 2]
For example from the same directory as the quickstart jar file:
mkdir static
mkdir static/repository
mkdir static/repository/install
mv myapp.zip static/repository/install
mv mycontent.zip static/repository/install
jar uf quickstart.jar static/repository/install/myapp.zip static/repository/install/mycontent.zip
Example
To provide a more in depth understanding, we will take a look at how CQ5 uses this feature.
CQ5.3 uses the install folder for auto-installing its packages. If you run java -jar cq-author-4502.jar -unpack
on a CQ5.3 jar then you will see the following CRX packages in crx-quickstart/repository/install
before you start the server for the first time:
cq-content-5.3.jar
cq-documentation-5.3.zip
After starting CQ5 for the first time you will see that 2 property files are generated under crx-quickstart/repository/install
. These files track that the packages have already been installed by the CRX Auto Installer:
cq-content-5.3.jar.properties
cq-documentation-5.3.zip.properties
Contents of a sample cq-content-5.3.jar.properties
file
#CRX Auto Installer
#Fri Jul 09 11:51:04 PDT 2010
installed=2010-07-09T11\:51\:04.733-07\:00
Summary
- CRX packages that are copied to
crx-quickstart/repository/install
are automatically installed on the next start of the CRX application. - The packages are installed in alphabetical order.
- To create a custom CRX Quickstart jar that will auto install your packages when CRX is installed then add your packages to the CRX Quickstart jar under
/static/repository/install/
. This can be done with the jdk jar commandjar uf [quickstart jar filename] static/repository/install/[package filename 1] static/repository/install/[package filename 2]
.
Applies To
CRX 1.4+