Initial project bootstrap
Download the latest SAP Commerce 2011 release zip file and put it into the
platform
folder using the correct file name, e.g.cp ~/Downloads/CXCOMM201100P*.ZIP ./platform/hybris-commerce-suite-2011.0.zipBootstrap the starting point for your Commerce project by running the following command:
./gradlew -b bootstrap.gradle.kts \ -PprojectName=<name, e.g. coolshop> \ -ProotPackage=<package, e.g. com.cool.shop>(N.B.: If you use a headless setup: You can delete the generated
<something>storefront
extension afterwards. Don't forget to remove it fromlocalextensions.xml
/manifest.json
)Review the generated configuration in
hybris/config
, especially thehybris/config/environment/*.properties
files andlocalextensions.xml
(search forTODO:
comments)Update the
manifest.jsonnet
(again, search forTODO:
comments).
You can use the jsonnet file to update themanifest.json
for your project.Delete all bootstrap files, you don't need them anymore:
rm -r bootstrap*
Delete this quote
Commit and push the changes to your project repository :)
We use Gradle + commerce-gradle-plugin to automate whole project setup.
git clone <project>
cd <project>
docker-compose up -d
cd core-customize
./gradlew setupLocalDevelopment
./gradlew yclean yall
./gradlew yinitialize
To generate the manifest.json
with Jsonnet:
jsonnet --output-file manifest.json manifest.jsonnet
- Add the addon to the
manifest.json
(either by hand or viamanifest.jsonnet
, documentation) - Run
./gradlew installManifestAddon
- Reformat
<storefront>/extensioninfo.xml
(unfortunately, the the platform build messes it up when adding addons) - Commit/push your changes
- Tell your team to run
./gradlew installManifestAddon
after pulling your changes, it this is not standard.
By combining the configuration reuse mechanism of CCv2, the optional configuration folder of Commerce and a bit of clever symlinking of files and folders, we can use the same configuration locally and in the cloud.
This setup uses:
hybris/config/localextensions.xml
to configure extensionshybris/config/environments/*.properties
to configure properties per CCv2 aspect. There is one file per aspect, plus the special filelocal-dev.properties
that configures the local development environmenthybris/config/local-config
is configured ashybris.optional.config.dir
and contains symlinks to the relevant property files inhybris/config/environments
(by default:common.properties
andlocal-dev.properties
).
Importantlocal.properties
must not be modified at all (that's why it is in.gitignore
).- If you have any configuration specific to your local machine, put it in
hybris/config/local-config/99-local.properties
. - If the local setup changes for the whole project, update
hybris/config/environments/local-dev.properties
- If you have any configuration specific to your local machine, put it in
- The default cloud solr configuration set is contained in the correct folder structure for CCv2 (documentation).
A symlink in
hybris/config/solr
allows to use the same configuration locally.
core-customize
├── ...
├── hybris
├── ...
│ ├── config
│ │ ├── environments
+--------------------> accstorefront.properties
|--------------------> admin.properties
|--------------------> api.properties
|--------------------> backgroundprocessing.properties
|--------------------> backoffice.properties
+--------------------> common.properties <---+
| │ │ │ └── local-dev.properties <--+ |
| │ │ ├── ... | | symlinks
| │ │ ├── local-config | |
manifest.json | │ │ │ ├── 10-local.properties +-----+
useConfig | │ │ │ ├── 50-local.properties +---+
properties | │ │ │ └── 99-local.properties
... +-------------+ │ │ ├── local.properties
extensions +--------------------------> localextensions.xml
solr +---------+ │ │ ├── readme.txt
| │ │ ├── solr
| │ │ │ └── instances
| │ │ │ └── cloud
| │ │ │ ├── configsets +-------+
| │ │ │ ├── ... |
| │ │ │ └── zoo.cfg |
| │ │ └── ... |
| ├── ... | symlink
+----------------> solr |
│ └── server |
│ └── solr |
│ └── configsets <-------------+
│ └── default
│ └── conf
│ ├── lang
│ ├── protwords.txt
│ ├── schema.xml
│ ├── solrconfig.xml
│ ├── stopwords.txt
│ └── synonyms.txt
└── ...
The file bootstrap-demo.gradle.kts
bootstraps a demo storefront based on the cx
recipe,
including the spartacussampledata
extension (necessary to demo the Spartacus storefront; documentation)
To generate the demo, run:
./gradlew bootstrap-demo.gradle.kts