/hybris

Hybris Development Boilerplate

Apache License 2.0Apache-2.0

Hybris Development Boilerplate

An ant based Hybris development boilerplate with automations.

Prequiresites

🔹 JAVA_HOME defined in System environment variables (version >= 8.0).

🔹 ANT_HOME defined in System environment variables (version >= 1.9.0).

🔹 ANT_OPTS defined in System environment variables (OPTIONAL), e.g. -Xmx1024m -Dfile.encoding=UTF-8.

🔹 HYB_BIN_DIR defined and appointed to your local Hybris bin package by the following orders:

1. passed in by CLI.
2. defined in System environment variables. 
3. defined in `.env` (ignored by `.gitignore`).

Features

  • all Hybris OOTB ant tasks.

  • handy/improved version of server related tasks.

  • package management supports via apache ivy.

  • custom packages definition supports (defined via ivy.xml, automatically installed).

  • build-in static code analysis (pre-build and pre-all) supports via checkstyle.

    • ignored Hybris generated files.
    • check all custom .java, .xml and .properties sources.
  • format helper to align with clean code (integrated into lint). :neckbeard:

    • Convert all tabs to spaces (size: 2).
    • Convert all EOLs to a single LF.
    • Remove any EOF character found at the end.
    • Add a missing EOL to the last line of a processed file.
  • multi settings profile via HYBRIS_CONFIG_DIR by following order:

    • passed in by CLI.
    • defined in System environment variables.
    • default settings profile - config/develop.
  • self introspection for unittests, integrationtests and alltests, Hybris OOTB packages excluded and custom packages included automatically. :neckbeard: NOTE custom extensions need to be defined in localextensions.xml.

  • .env based addoninstall and addonuninstall supports, pattern:

    <template>.<storefront>.addonnames = <addon-a>,<addon-b>,<addon-c>

Getting Started

git clone https://github.com/jimzhan/hybris.git && cd hybris
ant bootstrap

bootstrap will:

  1. try load .env from ${basedir} to provide additional settings supports;
  2. pre-defined (via HYB_BIN_DIR) Hybris packages will be copied into bin folder;
  3. Two settings profiles will be generated under config folder afterward:
  • config/develop - settings profile for development (default), generated via Hybris develop template.
  • config/testing - settings profile for online testing, generated via Hybris production template.
  1. apache ivy will be installed along with checkstyle.
  2. install custom dependencies defined in ${basedir}/ivy.xml (if any).

NOTE you can still generate new/individual settings profile using following command:

ant createConfig -DHYBRIS_CONFIG_DIR=`pwd`/config/<profile> -Dinput.template=<develop|production>

OOTB MOD

  • addoninstall - provides .env based supports via specific pattern (<template>.<storefront>.addonnames=<addon-a>,<addon-b>)
  • addonuninstall - provides .env based supports via specific pattern (<template>.<storefront>.addonnames=<addon-a>,<addon-b>)
  • restartHybrisServer - provides shortcut for stop-n-start current Hybris server.
  • restartSolrServer - provides shortcut for stop-n-start current Solr server.
  • startHybrisServer - starts Hybris server at the foreground (default) or background (via -Dmode=start, synonym to tomcat arguments).
  • stopHybrisServer - stops Hybris server at the background (if any).
  • alltests - OOTB Hybris alltests tasks with self-introspection supports.
  • integrationtests - OOTB Hybris integrationtests tasks with self-introspection supports.
  • unitests - OOTB Hybris unittests tasks with self-introspection supports.

Scaffoldings

  • bootstrap - create a new instance with multi settings profiles supports (develop/develop, testing/production).
  • format - convert all custom sources code into better standards (compliant with google_checks.xml). ❤️
  • lint - static code analysis via google_checks.xml (pre-format integrated).
  • purge - delete all generated data files and folders (data, log, roles, temp and velocity.log).

Why Ant?

  • simple, elegant and performant ❤️
  • first class integration with Hybris OOTB automations.
  • fast and stable, especially comparing to Gradle 💩.

NOTE Hybris OOTB ant tasks remain the same.

TODOs

  • editor/IDE/GIT settings.
  • Hybris OOTB ant tasks integrations.
  • Multi settings profiles supports.
  • daemon server supports.
  • create new settings profile.
  • addoninstall/addonuninstall supports mechanism.
  • running server detections.
  • Ivy package manager integration.
  • checkstyle integration (pre-build).
  • format all source code into google_checks.xml compliant mode.
  • auto-scope for testing.
  • localextensions.xml introspections.
  • Wiki Pages.