Ant Command Line Options

With ant command line features, you can quickly generate a localextensions.xml file to set up a build, and deploy only those extensions that you are planning to work with.

Summary of Commands

Command

Effect

ant extensionsxml -Dplatform.extensions="basecommerce"

Generates localextensions-generated.xml and loads all extensions needed to build the basecommerce extension.

ant extensionsxml -Dplatform.extensions="basecommerce" -Dplatform.extensionsgen.filename=localextensions.xml

Overwrites an existing localextensions.xml and loads all extensions needed to build the basecommerce extension.

ant extensionsxml -Dplatform.extensions="basecommerce backoffice" -Dplatform.extensions.scan.dirs="modules/base-commerce,modules/backoffice-framework,modules/api-registry,modules/platform" -Dplatform.extensions.scan.maxdepth=3

Builds basecommerce and backoffice. It also defines the lookup folders for those extensions and their dependent extensions: modules/base-commerce, modules/platform, and modules/backoffice-framework.

ant extensionsxml -Dplatform.extensions=" * "

Loads all extensions located in the modules folder.

ant extensionsxml -Dplatform.extensions=" *,-b2bpunchout,-b2bacceleratorservices,-b2bacceleratorfacades"

Excludes certain extensions in a build.

Automatic Generation of localextensions-generated.xml

This command generates a file called localextensions-generated.xml that you can rename to localextensions.xml and use as your configuration file.

The following is an example of building the basecommerce extension:

ant extensionsxml -Dplatform.extensions=basecommerce

When you enter this command, it generates a new extension configuration file. For safety reasons, it is saved to config/localextensions-generated.xml. Inside the file, you can see what parameters were used to generate it.

<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated via ant extensionsxml - please be aware that this file get overwritten each time!

Parameters:
 -Dplatform.extensions=basecommerce


-->
<hybrisconfig xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='resources/schemas/extensions.xsd'>

	<extensions>
		<!-- 
		     Please note that all extensions in platform/ext/* have been omitted 
		     because they're automatically loaded. Please use <extensions autoload='false'> 
		     in case you want to configure them explicitly. 
		  -->
		<extension dir='${HYBRIS_BIN_DIR}/modules/api-registry/apiregistryservices'/>
		<extension dir='${HYBRIS_BIN_DIR}/modules/base-commerce/basecommerce'/>
	</extensions>

</hybrisconfig>

To create or overwrite localextensions.xml directly, you can give your own name to the target file:

ant extensionsxml -Dplatform.extensions=basecommerce -Dplatform.extensionsgen.filename=localextensions.xml

Defining Scan Directories

You can define which directories ant should scan to locate defined extensions, and their extension dependecies. The locations are relative paths that translate to <HYBRIS_BIN_DIR>/modules/directory_name.

ant extensionsxml -Dplatform.extensions=basecommerce -Dplatform.extensions.scan.dirs=modules/base-commerce,modules/api-registry -Dplatform.extensions.scan.maxdepth=3

In the example, ant scans subdirectories also, to a maximum depth of three below the named directory.

Loading All Extensions in a Folder

In some special cases you might want to quickly configure all available extensions within a given folder rather than list them all one by one.

ant extensionsxml -Dplatform.extensions=" * "

Excluding Extensions

It is also possible to explicitly exclude some extensions. This is particularly useful when combined with the load all wildcard command.

ant extensionsxml -Dplatform.extensions=*,-b2bpunchout,-b2bacceleratorservices,-b2bacceleratorfacades