Phrase | Meaning |
---|---|
Version Control System (VCS) | Also known as source control, source code management systems (SCM), or revision control systems (RCS). VCS is a mechanism for keeping multiple versions of your files, so that when you modify a file you can still access the previous revisions. |
Artifact Repository | Place, where build and package software components are located. Provide a common interface to a dependency management system. |
Code Analysis | Process to analyze source code to calculate metrics, find bugs, etc. |
Continuous Delivery Pipeline | Sometimes called Deployment Pipeline, describes the stages, which code artifacts runs through source to production system. |
System Component | A software package of different code artifacts and files, that have to be deployed together. |
System Component Set | Is a container for system components, that needs to be build and branched together. |
Assembly | An assembly references one or more system components residing in the same or a configured artifact repository in order to deploy or deliver them together. |
Build Process | Compiles and packages files and code artifacts from a source project to deployable artifacts. |
Publish Process | The process which transfers the deployable artifacts to a configured artifact repository. |
Assembly Process | This process combines several system components to an assembly. |
Deployment Process | This process extracts files and code artifacts from an artifact repository and applies the configuration. |
Project Gradle Distribution | This is a customized Gradle distribution with the preconfigured artifact repositories and Gradle plugins. |
Gradle Plugin | A Gradle plugin packages up reusable pieces of build logic, which can be used across many different projects and builds. |
Project Gradle Plugin | This is a Gradle plugin which contains special corporate respectively project settings. |
Corporate Plugin | The term is used as a synonym for Project Gradle Plugin. |
Gradle Extension Object | Java Bean compliant class holding configurations for Gradle plugins. |
Gradle Wrapper | The Gradle Wrapper is the preferred way of starting a Gradle build. The wrapper is a batch script on Windows, and a shell script for other operating systems. When you start a Gradle build via the wrapper, Gradle will be automatically downloaded and used to run the build. See for more information The Gradle Wrapper in the Gradle documentation (2.11, 2.7, 2.3, 2.0, 1.8) |
Intershop Cluster | A number of hosts of different types serving an Intershop 7. |
Cluster Node | One separately deployable part of an Intershop cluster. A host can run multiple nodes of one Intershop cluster. |
This section gives an overview about the servers and their configuration, that are needed to run the Intershop build tools in a continuous integration environment. The following figure describes on a very high-level, how these servers interact with each other as well as where the particular build artifacts are located. Please read the Concept - Continuous Delivery Tools -> Infrastructurebefore, if you are not familiar with the overall concept:
The Intershop build tools require some tools and environment variables before they can be executed.
A Client of the Version Control System is needed to checkout the sources of the system components to be built. There is no dependency to a particular version control system.
JAVA_HOME
environment variable. GRADLE_USER_HOME
. See also "Appendix D. Gradle Command Line" of the "Gradle User Guide" .Gradle comes with a fresh approach for storing environment specific build configuration. Project/corporate specific build configuration is stored / linked from within the VCS with the sources of the project. This way:
This section describes artifacts required to implement this approach. Intershop provides templates from which you can easily create them for your project, see Cookbook - Setup CI Infrastructure (valid to GradleTools 1.1), resp. Cookbook - Setup CI Infrastructure (valid to GradleTools 2.1).
The approach is based on the Gradle webinar "Standardizing and Administering your Enterprise Build Environment".
Terminology: "project" vs. "corporate"
The terms "corporate Gradle distribution" and "project Gradle distribution" are used interchangeably throughout the documentation. The same applies to "corporate Gradle plugin" and "project Gradle plugin". If multiple development projects share the same CI environment, the prefix "corporate" indicates that they must also share these artifact.
The corporate Gradle plugin handles all necessary repository configurations for the company or project. It contains the URL of the repository server and the directory layout of the repositories.
Since Gradle Tools 2.0 the corporate Gradle plugin is replaced by:
IntershopPlugin
defining repositories based on the conventions established in Cookbook - Setup CI Infrastructure (valid to GradleTools 2.1). These conventions are common enough that it is not necessary for every development project/company to duplicate this code. This IntershopPlugin
reads the corporate.properties
to find company/project specific details.A corporate Gradle distribution consists of:
The Gradle wrapper is a small Java program that downloads a Gradle distribution and starts it. It is stored in the VCS with every source project and contains a URL to the corporate Gradle distribution. By checking out this wrapper and invoking Gradle through it, the project specific configuration is automatically loaded on every Gradle invocation .
This makes the Gradle wrapper the preferred way of starting a Gradle build.
There are different kinds of Gradle plugins in the component oriented build of Intershop. Most plugins come with a default configuration, so for the most system components it is not necessary to create a special configuration. The Intershop Gradle plugins extend the Gradle DSL with their own extensions.
Plugins for managing the repository chain, Ivy patterns and versions. These plugins are typically applied by the Project Gradle Distribution.
Plugin Name | Description |
---|---|
| Used to determine the version string of particular system components or assemblies |
corporate (com.intershop.build.plugins.IntershopPlugin) | Used to configure the artifact repository chain. |
Depending on the contents of a cartridge different plugins must be applied for building it. These plugins cover building most common artifacts in Intershop cartridges.
Plugin Name | Description |
---|---|
java-cartridge | Compiles all Java classes of the project |
static-cartridge | Packages all files in source folder staticfiles/cartridge/* |
The following plugins cover building less common artifacts.
Plugin Name | Description |
---|---|
ish-jaxb-plugin | Generates Java sources from XSD files located in staticfiles/definition |
ish-wsdl-plugin | Generates Java sources from WSDL files located in staticfiles/wsdl |
ish-javacc-plugin | Generates Java sources for parsers |
ish-isml-plugin | Generates JSP files from ISML files located in staticfiles/cartridge/templates |
ish-jsp-plugin | Generates Java source files from JSP files |
ish-tloc-plugin | Provides tasks for the TLoc tool |
ish-sonar-plugin | Provides tasks to analyze code as well as upload reports |
ish-resourcelist-plugin | Generates the resource lists for ORM and Pipelet classes |
Intershop components are organized in system component sets. A system component set is build as a multi-project build (see Build Lifecycle in Concept - Continous Delivery Tools ).
The system component set itself is the root project. Its project directory is the system component set directory. Components are direct child projects, their project directories are direct subdirectories of the system component set directory. The Gradle settings file in the component set directory determines which subdirectories should be treated as components.
Each component directory contains a build.gradle file for component specific build configuration. Common configuration for all sub projects is consolidated in the build.gradle of the system component set directory.
The system component set directory also contains a Gradle wrapper (see GradleWrapper).
The system component set directory contains the following files and directories:
Folder / File | Description |
---|---|
.settings | Configuration of Intershop Studio plugins |
gradle | The Gradle Wrapper and its configuration |
<system component> | The system components (cartridge) reside beside the Gradle Wrapper directory. |
settings.gradle | Configuration of sub projects and build plugins |
gradlew.bat | Windows start script of Gradle Wrapper |
gradlew | Linux start script of Gradle Wrapper |
gradle.properties | Build properties of project including JVM settings of build process, version of project, ... |
.project | Project file of Intershop Studio |
.classpath | Class path configuration of project in Intershop Studio |
This configuration is used for all components in a component set. This should reduce the overhead when changes on this level in the configuration are necessary.
apply plugin: 'component-set' description 'Components Business Platform' group = 'com.intershop.set' subprojects { apply plugin: 'intershop-base' group = 'com.intershop' intershop { productName = 'Intershop' productCopyrightOwner = 'Intershop Communications' } project.plugins.withType(JavaBasePlugin) { sourceCompatibility = 1.7 targetCompatibility = 1.7 } project.tasks.withType(Test) { test.ignoreFailures = true } } buildscript { dependencies { classpath group: 'com.intershop.build.gradle', name: 'ish-component-plugin' classpath group: 'com.intershop.build.gradle', name: 'assembly' } }
Line 1 | Use Intershop build plugin component-set for building the root project |
Line 3 | Description of the root project / component set |
Line 5 | The following configuration steps will be applied to all sub projects |
Line 6 | All components of this project are Intershop components. Therefore, the Intershop base plugin will be applied to all sub projects of this multi project. |
Line 7 | All components will be published for the group com.intershop . |
Lines 8-11 | The product name ( productName ) and the copyright owner ( productCopyrightOwner ) are set inside the Intershop DSL extension. |
Lines 13-16 | The source and the target compatibility is set for all sub projects with an applied JavaBasePlugin . The Intershop plugin applies by default the JavaBasePlugin . |
Lines 18-20 | Failed tests should not stop the build. This is a configuration that should only be used during a migration time. |
Lines 22-27 | This is dependency configuration for the build script. The |
The version of the components in the component set is stored in the gradle.properties.
# project settings version = 7.4.6.0 # build script version filter.com.intershop.build.set.cartridge-plugins = 1.0.0.0.+
Properties of the form "filter.*" and "version.*" are interpreted by the Versioning plugin, see Versioning.
The system components reside in a system component set and are part of a multi-project build process as described above. The Intershop Build Tools are based on the standard plugins delivered with Gradle, e.g., the Java Plugin.
The Intershop Build Tools (Gradle build plugins) require a defined layout of particular source project residing in the version control system. The conventions for folder names and contents have two origins:
The following table gives an overview about the project layout of a system component / cartridge:
Folder | Description |
---|---|
deployment | Contains custom Gradle scripts customizing the deployment process |
edl | Contains EDL files used to generate code in a development environment |
javasource/<package name> | Contains Java code and resource files |
src/test/java | Contains mere JUnit tests |
src/test/resources | Contains the resources for the mere JUnit tests |
staticfiles/cartridge/components | Contains the component files of the Component Framework |
staticfiles/cartridge/config | Contains the configuration read by the Configuration Framework |
staticfiles/cartridge/extensions | Contains the extension files of the Extension Framework |
staticfiles/cartridge/impex | Contains configurations for import and export processes |
staticfiles/cartridge/lib | Contains external libraries (jars) as well as files, that need to be deployed unpacked into the lib folder of particular cartridge |
staticfiles/cartridge/localization | Contains the resource bundles for the localization |
staticfiles/cartridge/pipelines | Contains the pipelines |
staticfiles/cartridge/queries | Contains the queries |
staticfiles/cartridge/static/[default|<language>] | Contains the static files of cartridge like icons, images, JavaScript as well as CSS files |
staticfiles/cartridge/templates/ [default|<language>] | Contains the ISML templates |
staticfiles/cartridge/webforms | Contains the webforms (see: Concept - Webforms) |
staticfiles/cartridge/webservices | Contains the WSDD files of Axis 1 webservices |
staticfiles/definition | XSD and XJB files used to generate Java code via JAXB |
staticfiles/general/[root|<folder name>] | Files to be deployed to the the local root directory (IS_HOME) or another special folder |
staticfiles/share/sites | Static files of particular sites (images, import files, CSS, branding, ...) |
staticfiles/share/system | Configuration files, that need to be deployed |
staticfiles/share/tloc | TLoc files (deprecated) |
staticfiles/wsdl | WSDL files of webservices (see: Web Service Description Language) |
build.gradle | Build configuration of system component including required build plugins, dependencies to other system components, etc |
.project | Project file of Intershop Studio |
.classpath | Class path configuration of project in Intershop Studio |
The plugins for different system component types can be combined for an Intershop Cartridge.
Intershop provides a special version plugin, this plugin sets the correct versions from the filter and versions settings in the gradle.properties.
apply plugin: 'java-cartridge' apply plugin: 'static-cartridge' intershop { displayName = 'Component - SubProject' description = 'This is an example' } dependencies { compile project(':bc_foundation') compile project(':bc_mail') compile group: 'com.intershop.platform', name: 'core' compile group: 'com.intershop.platform', name: 'orm' compile group: 'com.intershop.platform', name: 'tools' compile group: 'com.intershop.platform', name: 'cache' compile group: 'com.google.guava', name: 'guava' compile group: 'org.slf4j', name: 'slf4j-api' }
Lines 1-2 | The plugins for a cartridge with Java and static content are applied to this build. |
Lines 4-6 | There are no special configurations necessary for this example cartridge. Only the |
Line 9 | This is the standard dependency extension of this Gradle project. See Chapter Dependency Management Basics of the Gradle User Guide or Chapter Dependency Management. |
Lines 10,11 | Dependencies to components in the same component set |
Lines 12-15 | External dependencies to components of other component sets |
Lines 16-17 | Since Gradle Tools 2.7: External dependencies to 3rd party libraries can be declared per component. These dependencies will be aggregated by the assembly. |
Note
Compile dependencies of a component are not resolved transitively in the Intershop component oriented build.
The publishing process is always a part of the build process. Publishing makes built artifacts available for the usage in other builds and for deployment. In the most cases artifacts are published to shared repositories as part of the CI build. Developers publish artifacts always to a local repository.
An Intershop component consists of more than one artifact. Therefore Intershop uses Ivy Publishing for sharing of artifacts.
Artifact | Description and Usage |
---|---|
<name>-local-<classifier>.zip | Package for the installation in a directory on a special host. The classifier is only used for packages with platform specific software. |
<name>-share.zip | Package for the installation in shared file system. This shared files system is used from all application servers. |
<name>-cartridge.zip | Package of static content of an Intershop cartridge |
<name>.jar | Java archive with Java classes. This is only avaiable if the component contains Java sources or contains Java libraries. |
deploy.gradle | Gradle file with special deployment steps. This artifact is optional for cartridges. |
ivy.xml | Contains the dependency configuration of a component and meta information (name, description, display name etc) |
The Intershop base plugin applies the Gradle "ivy-publish" Plugin.
There are two types of dependencies:
During build dependencies must be resolved, i.e., to retrieve jar files and other artifacts to build/deploy. Project dependencies are resolved within the source and target folder of the system component set. External dependencies are resolved from one or more repositories, which may contain different versions of the same component. For external dependencies it must therefore be possible to control which of these versions will be used.
It is possible to write dependency version numbers directly into the build.gradle file, as described by the Gradle User Guide. This however has several disadvantages:
Using version expressions, like 1.0.0.+
, that resolve dynamically to the latest matching version does help with the first two items. It however introduces a strong instability. Executing a command once and then a second time can lead to different results, if in between a new version was published. Also previous build processes cannot be repeated to diagnose problems.
The Gradle build tools come with a versioning plugin that is applied by the project Gradle distribution. The versioning plugin allows to specify dependency versions via Gradle project properties.
Build plugin versions
The versioning plugin is not only used to specify versions of compile dependencies. It is also used to specify which version of the build plugins have to be used. Examples are the properties filter.com.intershop.build.set.cartridge-plugins
and filter.com.intershop.build.set.extension-plugins
.
Scope
The versioning plugin controls version information for all build steps including assembly. However, it does not affect the deployment, whose versioning is managed only by the deployed assembly's ivy descriptor.
The versioning plugin recognizes two different kinds of properties:
Version properties have the syntax: version.<component organization>.<component name> = <version number>
, e.g., version.com.intershop.core = 7.4.6.1.20131212121212
.
They determine the version of a single component. In the above case all dependencies to core are resolved to version 7.4.6.1.20131212121212
.
Filter properties have the syntax: filter.<assembly organization>.<assembly name> = <version number>
, e.g., filter.com.intershop.assembly.intershop7
= 7.4.6.1.201312121212
.
They determine the version of multiple components at once by specifying an assembly or system component set. In the example above all dependencies to components contained in version
of the assembly 7.4.6.1.201312121212
intershop7
will be resolved using the versions given in the assembly's ivy.xml file. For example if intershop7
in version
contains version
7.4.6.1.201312121212
2.2.25.0.20131125224905
of com.intershop:3rd_apache
, dependencies to 3rd_apache
will resolve to this version. Another example using a component set: Specifying filter.com.customer.set.platform-cartridges = 1.1.0.0-local
causes a build against local versions for all system components in this set.
Filter assemblies and their own versions
Filter properties determine a version only for all components contained in the specified assembly/system component set, not of the assembly/system component set itself. If - for any reason - the system component set or assembly itself needs to be resolved as dependency:
Set an additional version property.
Refined behaviour since Gradle Tools 2.1
Starting with Gradle Tools 2.1, filter properties do not apply for their own assembly build process anymore, in order to avoid cyclic reproduction of incorrect version information.
Example: Given a filter property filter.com.customer.assembly.customer-assembly = 1.1.0.0-local
, this version filter does not apply for the build of customer-assembly
itself. The assembly must therefore provide versioning for all of its contained system components via other means, e.g., via a filter of a component set: filter.com.customer.set.customer-cartridges = 1.1.0.0-local
.
In certain situations multiple versions may be selected based on the given version and filter properties. For example, you may set filter.com.intershop.assembly.intershop7
= 7.4.6.1.201312121212
, containing 3rd_tomcat
version 2.2.25.0.20131125224905
and version.com.intershop.3rd_tomcat=2.4.13.0.20141125224905
.
The following rules are used to determine which version to choose:
'-local'
it will be used. This allows easy replacement of components with locally built versions for developers.Filter conflicts can be solved by disambiguation. You can either:
Gradle project properties can be set in different physical locations:
-P<property>=<value>
.
If different locations contain different values for the same property, they override each other in this order. That is:
compile group: 'com.intershop.platform', name: 'core'
compile
group: 'com.intershop.platform', name: 'core', version: '7.5.0.+'
filter.com.customer.set.shop-cartridges=1.0.0.+
which will always use the latest available build of the branch 1.0.0
. This is discouraged. As mentioned in the beginning of this chapter this can lead to surprises and timing issues. Instead always give full version and build numbers.The templates provided for the system component set and assembly already follow these practices. See Cookbook - Setup CI Infrastructure (valid to GradleTools 1.1).
Intershop extends the Gradle DSL for building cartridges and components following Intershop conventions. Most Intershop Gradle plugins come with a default configuration.
Since the Intershop component oriented build only extends Gradle, a project build configuration can be extended with third-party or own Gradle plugins. For special requirements, the build configuration can be adapted and expanded to include additional build steps.