Skip to content

IntershopCommunicationsAG/icm-gradle-plugin

Repository files navigation

Intershop Commerce Management Project Plugins

CAUTION: Version 6.0.0 requires Gradle 8.5!

Summary

This plugin collection contains plugins for building all necessary artifacts of an Intershop Commerce Management Server.

Intershop Commerce Management Cartridge Plugins

Cartridge Plugins

The abstract Cartridge plugin adds a pom property "cartridge.style" if the Gradle "Maven Publish Plugin" is applied.

Container Cartridge Plugin

This plugin applies the standard Cartridge plugin only and should be used for cartridges that are only deployed to a container. It adds an extra property "cartridge.style" to the Cartridge project. The value of the property is "container". There is no publishing configuration for an external Maven repository.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.container' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.container") version "6.0.0"
}

Product Cartridge Plugin

This plugin applies the "Public Cartridge Plugin" and adds an extra property "cartridge.style" to the Cartridge project. The value of the property is "cartridge". This value is also set for the pom property. It should be applied to projects for further development. The following artifacts will be published to a Maven repository: jar, source jar, and javadoc jar.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.product' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.product") version "6.0.0"
}

Adapter Cartridge Plugin

This plugin applies the "External Cartridge Plugin" and adds an extra property "cartridge.style" to the Cartridge project. The value of the property is "adapter" and it is also set to the pom property. This plugin should be applied to special adapter Cartridges like payment or search connectors.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.adapter' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.adapter") version "6.0.0"
}

Development Cartridge Plugin

This plugin applies the "External Cartridge Plugin" and adds an extra property "cartridge.style" to the Cartridge project. The value of the property is "development". This plugin should be applied to special development projects. This kind of Cartridges is not available in a production or test container.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.development' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.development") version "6.0.0"
}

Test Cartridge Plugin

This plugin applies the "Cartridge Plugin" and adds an extra property "cartridge.style" to the Cartridge project. The value of the property is "test". This plugin should be applied to special test projects. This kind of Cartridges are not available in a production container.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.test' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.test") version "6.0.0"
}

Cartridge Plugin

  • This plugin applies the Gradle "Java Plugin" to the project.

  • It applies two configurations

    • cartridge and

    • cartridgeRuntime
      to the project.

  • The following tasks are added by the plugin:

    • writeCartridgeDescriptor

It is not necessary to apply this plugin to a project separately, because it has been applied by some of the plugins above.

Configurations

Configuration name Transitive Extends Usage

cartridge

false

implementation

for Cartridge dependencies

cartridgeRuntime

true

cartridge

for Cartridge runtime dependencies

Tasks

Task name Class Description

writeCartridgeDescriptor

com.intershop.gradle.icm.tasks
WriteCartridgeDescriptor

Creates a the Cartridge descriptor file cartridge.descriptor.

[1] The default value of "classpath.file.enabled" is false.

[2] Files, installed on the container of the base project, will be not copied if the base project provides a filter file. There is also a special setting in the extension possible. List entries have the following form: <group name>-<module name>-<version>.

Public Cartridge Plugin

This plugin applies the Gradle "Maven Publish Plugin" to a project and configures the publication of a plugin for further development. It adds the project library, the source, and Java doc jars to the publication and the description and the inception year to the pom. Furthermore the pom property "cartridge.name" is added to the publishing configuration.

It is not necessary to apply this plugin to a project separately, because it has been applied by some of the plugins above.

This plugin applies the Gradle "Maven Publish Plugin" to a project.

External Cartridge Plugin

This plugin applies the "Public Cartridge Plugin". It adds the task zipStaticFiles for publishing. Furthermore the output of the task writeCartridgeDescriptor is added to zipStaticFiles. The pom property cartridge.type is set to external. This plugin is used for Cartridges that will be available for projects based on the Intershop Commerce Management server. These Cartridges will be added to the project configuration for development, test purposes, and also for special feature sets.

Tasks

Task name Class Description

zipStaticFiles

com.intershop.gradle.icm.tasks
ZipStaticFiles

Creates a zip file with the static Cartridge content.

Groovy
build.gradle
plugins {
    id 'com.intershop.icm.cartridge.test' version '6.0.0'
    id 'com.intershop.icm.cartridge.external' version '6.0.0'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.icm.cartridge.test") version "6.0.0"
    id("com.intershop.icm.cartridge.external") version "6.0.0"
}

This will configure a test Cartridge for external usage.

Intershop Commerce Management Base Plugin

This plugin will be applied to a root project of an Intershop Commerce Management project with Cartridge sub projects. It configures all sub projects and the root project.

The plugin applies the Gradle "Maven Publish Plugin" to the root project and it creates the configurations cartridge and cartridgeRuntime in the root and all sub projects.

Plugin Configuration

Groovy
build.gradle
plugins {
    id 'com.intershop.gradle.icm.base' version '6.0.0'
}

intershop {

    projectInfo {
        productID = 'ICM 7 B2C'
        productName = 'Intershop Commerce Management 7 B2C'
        copyrightOwner = 'Intershop Communications'
        copyrightFrom = '2005'
        organization = 'Intershop Communications'
    }

    mavenPublicationName = 'ishmvn'
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.gradle.icm.base") version "6.0.0"
}

intershop {

    projectInfo {
        productID.set("ICM 7 B2C")
        productName.set("Intershop Commerce Management 7 B2C")
        copyrightOwner.set("Intershop Communications")
        copyrightFrom.set("2005")
        organization.set("Intershop Communications")
    }

    mavenPublicationName.set("ishmvn")
}

The project information (projectInfo) is used in the display of the login dialog of the ICM back office.

Extension 'intershop' for Base Plugin

Properties

Property Type Default value Description

mavenPublicationName

String

mvn

The property is used for the publishing configuration.

Methods

Method Parameter Description

developmentConfig

Action<in `DevelopmentConfiguration>`

Configures a development configuration from an action.

developmentConfig

Closure<Any>

Configures a development configuration from a closure.

projectInfo

Action<in ProjectInfo>

Configures a project information from an action.

projectInfo

Closure<Any>

Configures a project information from a closure.

Object DevelopmentConfiguration

Properties
Property Type Default value Description

configDirectory

String

One of these values in the following order:
1. value of environment variable CONFIGDIR
2. value of system property configDir
3. value of Gradle property configDir
4. default value $GRADLE_USER_HOME/icm-default/conf

Path of a directory with a local environment specific configuration file. This is necessary to overwrite an existing configuration of a server, such as the database settings.

configFilePath

String

<configDirectory>/icm.properties

The absolute path of the configuration file.

Note
All properties are read only.

Object ProjectInfo

Properties
Property Type Read only Default value Description

productIDProvider

Provider<String>

x

productID instance

Provider of the product ID of the project.

productID

Property<String>

ICM

Product ID property.

productNameProvider

Provider<String>

x

productName instance

Provider of the product name of the project.

productName

Property<String>

Intershop Commerce Management 7

Product name property.

copyrightOwnerProvider

Provider<String>

x

copyrightOwner instance

Provider of the copyright owner of the project.

copyrightOwner

Property<String>

Intershop Communications

Copyright owner property.

copyrightFromProvider

Provider<String>

x

copyrightFrom instance

Provider of the 'copyright from' property.

copyrightFrom

Property<String>

2005

'Copyright from' property.

organizationProvider

Provider<String>

x

organization instance

Provider of the organization property.

organization

Property<String>

Intershop Communications

Organization property.

Dependency Configurations

Configuration name Transitive Extends Usage

cartridge

false

implementation

for Cartridge dependencies

cartridgeRuntime

true

cartridge

for Cartridge runtime dependencies

Tasks

Task name Class Description

allDependencies

org.gradle.api.tasks.diagnostics
DependencyReportTask

Displays the dependency tree for a project. An instance of this type is used when you execute the dependencies task from the command-line.

collectLibraries

com.intershop.gradle.icm.tasks
CollectLibraries

Collects all libraries (recursively through all (sub-)projects).

createServerInfo

com.intershop.gradle.icm.tasks
CreateServerInfo

Creates a properties file with all project information. This property is used by the server.

createMainPkg

com.intershop.gradle.icm.tasks
CreateMainPackage

This is a preconfigured Tar task. It creates <build dir>/packages/mainpkg.tgz as base for container creation. It contains all components of the main appserver container. Cartridges will be added per default.

createTestPkg

com.intershop.gradle.icm.tasks
CreateTestPackage

This is a preconfigured Tar task. It creates <build dir>/packages/testpkg.tgz as base for container creation. It contains all components of the test container. Test cartridges will be added per default.

Intershop Commerce Management Project Plugin

This plugin applies the Intershop Commerce Management Base plugin to the project. It adds also additional tasks and configuration for projects that are based on an Intershop Commerce Management base project like Intershop Commerce Management B2X 7.11. A base project provides a container with an installed server configuration. The configuration of tasks created by the base plugin is extended by this plugin. It adds files configured by the extension of this plugin to the container packages.

Plugin Configuration

Groovy
build.gradle
plugins {
    id 'com.intershop.gradle.icm.project' version '6.0.0'
}

intershop {

    projectInfo {
        productID = 'ICM 7 Project'
        productName = 'Intershop Commerce Management 7 Project'
        copyrightOwner = 'Intershop Communications'
        copyrightFrom = '2005'
        organization = 'Intershop Communications'
    }

    mavenPublicationName = 'ishmvn'

    projectConfig {
        cartridges = [ 'com.intershop.cartridge:cartridge_dev:1.0.0',
                       'projectCartridge_prod',
                       'com.intershop.cartridge:cartridge_prod:1.0.0',
                       'projectCartridge_test']

        dbprepareCartridges = [ 'projectCartridge_prod',
                                'com.intershop.cartridge:cartridge_prod:1.0.0' ]

        base {
            dependency = "com.intershop.icm:icm-as:1.0.0"
            platforms = [ "com.intershop.icm:versions:1.0.0" ]
        }

        modules {
            solr {
                dependency = "com.intershop.search:solrcloud:1.0.0"
            }
            payment {
                dependency = "com.intershop.payment:payment:1.0.0"
            }
        }
    }
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.gradle.icm.project") version "6.0.0"
}

intershop {

    projectInfo {
        productID.set("ICM 7 B2C")
        productName.set("Intershop Commerce Management 7 B2C")
        copyrightOwner.set("Intershop Communications")
        copyrightFrom.set("2005")
        organization.set("Intershop Communications")
    }

    mavenPublicationName.set("ishmvn")

    projectConfig {
        cartridges.set(listOf("com.intershop.cartridge:cartridge_dev:1.0.0",
                       "projectCartridge_prod",
                       "com.intershop.cartridge:cartridge_prod:1.0.0",
                       "projectCartridge_test"))

        dbprepareCartridges.set(listOf("projectCartridge_prod",
                                "com.intershop.cartridge:cartridge_prod:1.0.0"))

        base {
            dependency.set("com.intershop.icm:icm-as:1.0.0")
            platforms("com.intershop.icm:versions:1.0.0")
        }

        modules {
            register("solr") {
                dependency.set("com.intershop.search:solrcloud:1.0.0")
            }
            register("payment") {
                dependency.set("com.intershop.payment:payment:1.0.0")
            }
        }
    }
}

Extension 'intershop' for Project Plugin

This plugin uses additional methods and objects to configure all necessary tasks. See 'Extension 'intershop' for Project Plugin' for base configuration.

Methods
Method Parameter Description

projectConfig

Action<in ProjectConfiguration>

Configures a configuration of a project based on Intershop Commerce Management from an action.

projectConfig

Closure<ProjectConfiguration>

Configures a configuration of a project based on Intershop Commerce Management from a closure.

Object ProjectConfiguration
Properties of ProjectConfiguration

Read only properties

Property Type Default value Description

containerConfig

File

$BUILDDIR/
container/config_folder

Contains the complete configuration of a project container.

testContainerConfig

File

$BUILDDIR/
testcontainer/config_folder

Contains the test configuration only for a special test container of the project.

config

File

$BUILDDIR/
server/config_folder

Contains the complete configuration of a development server. It contains test as well development configuration.

Property

Type

Default value

Description

newBaseProject

boolean

false

If this property is true, the configuration release can be used as a new base project.

cartridgeListDependency

Property<String>

optional

If the base cartridge list configuration should not be taken from the base project, it is necessary to specify a separate configuration.

libFilterFileDependency

Property<String>

optional

If the base library filter configuration should not be taken from the base project, it is necessary to specify a separate configuration.

cartridges

SetProperty<String>

This configuration is used to extend the base cartridge list for the project. It contains a set of cartridge dependencies and project names.

dbprepareCartridges

SetProperty<String>

This configuration is used to extend the base cartridge list for the project for Database preparation. It contains a set of cartridge dependencies and project names.

Methods of ProjectConfiguration
Method Parameter Description

cartridge

String

Add a cartridge to the list of cartridges. This can be a project name or a short module dependency configuration (group:module:version).

dbprepareCartridge

String

Add a cartridge to the list of cartridges for Database preparation. This can be a project name or a short module dependency configuration (group:module:version).

modules is a NamedDomainObjectContainer of CartridgeProject a configuration is possible in a Closure or in a Action. Methods are generated by Gradle automatically. This container contains a list of additional projects for integration like search and payment integrations.

Object CartridgeProject

Properties of CartridgeProject

Property Type Default value Description

dependency

Property<String>

It contains the dependency on the base project. Only a short module dependency configuration (group:module:version) is allowed.

platform

SetProperty<String>

It contains the dependencies of BOM files to configure versions during the setup of external cartridges. Only short module dependency configurations (group:module:version) are allowed in this list.

Methods of CartridgeProject

Method Parameter Description

configPackage

Action<in FilePackage>

Configures the configuration package of the cartridge project from an action.

configPackage

Closure<FilePackage>

Configures the configuration package of the cartridge project from a closure.

Object FilePackage

This configuration prepares a CopySpec for the file packages of a cartridge project object.

Properties of FilePackage

Property Type Default value Description

includes

SetProperty<String>

Optional

This is a set Ant based exclude patterns.

excludes

SetProperty<String>

Optional

This is a set Ant based include patterns.

duplicateStrategy

Property
<DuplicatesStrategy>

DuplicatesStrategy.
INHERIT

This is the specified duplication strategy. See also DuplicatesStrategy

targetPath

Property<String>

Optional

The target path of this package.

Methods of CartridgeProject

Method Parameter Description

include

String

Adds an include pattern to the set.

includes

Collection<String>

Adds a collection of include patterns to the set.

exclude

String

Adds an exclude pattern to the set.

excludes

Collection<String>

Adds a collection of exclude patterns to the set.

Object ServerDirSet

This configuration prepares a CopySpec for the directories of the project. The ServerDirSet object contains a container dirs of single real directories.

Properties of ServerDirSet

Property

Type

Default value

Description

dir

SetProperty<String>

Required

Path in the project structure.

includes

SetProperty<String>

Optional

This is a set Ant based on exclude patterns.

excludes

SetProperty<String>

Optional

This is a set Ant based on include patterns.

targetPath

Property<String>

Optional

The target path of this package.

Methods of ServerDirSet

Method Parameter Description

include

String

Adds an include pattern to the set.

includes

Collection<String>

Adds a collection of include patterns to the set.

exclude

String

Adds an exclude pattern to the set.

excludes

Collection<String>

Adds a collection of exclude patterns to the set.

Object DirConfig

This configuration prepares a CopySpec for the directories of the project.

Property Type Default value Description

dir

DirectoryProperty

This is the source directory of the configuration.

includes

SetProperty<String>

Optional

This is a set Ant based on exclude patterns.

excludes

SetProperty<String>

Optional

This is a set Ant based on include patterns.

targetPath

Property<String>

Optional

The target path of this directory configuration.

Methods of DirConfig

Method Parameter Description

include

String

Adds an include pattern to the set.

includes

Collection<String>

Adds a collection of include patterns to the set.

exclude

String

Adds an exclude pattern to the set.

excludes

Collection<String>

Adds a collection of exclude patterns to the set.

Tasks

The Intershop Commerce Management Project Plugin adds the following tasks to the existing project. It configures the root project and sub projects. The main goal of all tasks is the preparation of a configuration directory of a development server, a container, and a test container. Other tasks will prepare all external cartridges for the different server configurations.

Task name Type Description

prepareServer

org.gradle.api
Task

Start all tasks to prepare a complete server file structure for development.

prepareTestContainer

org.gradle.api
Task

Start all tasks to prepare a file structure to create a test container based on the container of the project.

prepareContainer

org.gradle.api
Task

Start all tasks to prepare a complete file structure to create a container for the project.

createConfigProd

com.intershop.gradle.icm.tasks
CreateConfigFolder

Creates the complete configuration file structure for the container creation.

createConfigTest

com.intershop.gradle.icm.tasks
CreateConfigFolder

Creates the configuration file structure for the test container creation.

createConfig

com.intershop.gradle.icm.tasks + CreateConfigFolder`

Creates the complete configuration file structure of a development server.

provideCartridgeListTemplate

com.intershop.gradle.icm.tasks
ProvideCartridgeListTemplate

Downloads the base cartridge list configuration from a dependency.

extendCartridgeListProd

com.intershop.gradle.icm.tasks
ExtendCartridgeList

Extends the base cartridge list configuration for the container creation.

extendCartridgeListTest

com.intershop.gradle.icm.tasks
ExtendCartridgeList

Extends the base cartridge list configuration for the container creation.

extendCartridgeList

com.intershop.gradle.icm.tasks
ExtendCartridgeList

Extends the base cartridge list configuration of a development server.

provideLibFilter

com.intershop.gradle.icm.tasks
ProvideLibFilter

Downloads a file for lib filtering for the container creation from a dependency.

setupCartridgesProd

com.intershop.gradle.icm.tasks
SetupCartridges

Prepares a structure of external cartridges for the container creation.

setupCartridgesTest

com.intershop.gradle.icm.tasks
SetupCartridges

Prepares a structure of external cartridges for the test container creation.

setupCartridges

com.intershop.gradle.icm.tasks
SetupCartridges

Prepares a structure of external cartridges of a development server.

copyLibsProd

org.gradle.api.tasks
Sync

Synchronizes libraries from all cartridges with a single libraries directory of a container.

copyLibsTest

org.gradle.api.tasks
Sync

Synchronizes libraries from all cartridges with a single libraries directory of a test container.

copyLibs

org.gradle.api.tasks
Sync

Synchronizes libraries from all cartridges with a single libraries directory of a development server.

zipConfiguration

org.gradle.api.tasks.bundling
Zip

Creates a zip file of configuration files for publishing. The content depends on the property newBaseProject.

preparePubConfiguration

com.intershop.gradle.icm.tasks
PreparePublishDir

Prepares the directory for publishing of a configuration package from the extension configuration.

Build Directory Overview for Further Usage

   - build                <build directory of the main project>
    |
    +- server             <necessary directories and files of a server>
    |  |
    |  +- cartridges      <contains all external cartridges, like payment, search, etc.>
    |  |  |
    |  |  +- libs         <contains all additional 3rd party libs of external cartridges>
    |  |  +- cartridge1
    |  |  +- cartridge2
    |  |  ...
    |  |
    |  +- config_folder   <target folder for configuration files>
    |  |  |
    |  |  +- system-conf
    |  |     |
    |  |     +- cluster
    |  |     ...
    |  +- prjlibs         <target of all additional 3rd party libs of the project>
    |  |  |
    |  |  +- <group>-<module>-<version>.jar
    |  |  |
    |  |  ...
    |  |
    +- container          <necessary directories and files of a container>
    |  |
    |  +- cartridges
    |  +- config_folder
    |  +- prjlibs
    |
    +- testcontainer      <necessary directories and files of a test container>
       |
       +- cartridges
       +- config_folder
       +- prjlibs

Contribute

See here for details.

License

Copyright 2014-2021 Intershop Communications.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.