This cookbook gives practical advise on how to develop using Gradle and Intershop build and deployment tools. The target audience are developers of Intershop customer projects and partners. Knowledge of Concept - Continuous Delivery Tools (valid to 7.10) is assumed.The cookbook presents a directory setup and workflow, that is optimized for a single system component set and assembly.
Names in angle brackets
Upper case names in angle brackets like <COMPONENTSET> are references to environment variables. Replace them by the proper OS-dependent syntax, e.g., %COMPONENTSET%
on Windows or $COMPONENTSET
on Linux. The environment variables are set by the gradle_environment.bat or gradle_environment.sh scripts (see recipes Setup a Development Environment and Run Gradle Tasks).
Before a single developer can set up an environment, a few things have to be set up first for the team. The required team setup is out of scope of this cookbook. Such information is included in:
Cookbook - Gradle Assembly Tools (valid to 7.8) - create an assembly
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. Place, where build and package software components are located. Provide a common interface to a dependency management system.Phrase Meaning Version Control System (VCS) Artifact Repository 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.
I want to develop on Intershop 7.4 CI or later. How get I a Gradle-based development environment?
Ensure the preconditions are fulfilled before starting the development.
Setting up an development environments consists of the following steps:
The following steps provide you with a jump start without further ado. See discussion for further details.
Since command line syntax on Windows and Linux slightly differ, the steps are provided once for Windows and once for Linux. Except for the command line syntax both are equivalent.
# | Action | Explanation |
---|---|---|
1 | Check if the minimum System Requirements are fulfilled.
Additionally to the general requirements:
| For gradle_environment.bat created with Gradle Tools >= 2.0: The gradle_environment.bat (see next step) by default expects the Intershop Studio executable to be installed at C:\intershop\IntershopStudio\IntershopStudio.exe. If your Intershop Studio is located elsewhere adapt the line defining openStudio in gradle_environment.bat accordingly. |
2 | For Gradle Tools version 1.0-1.1: Create an empty directory to contain your development environment. Check out preconfigured Gradle user home ( gradle_user_home ) from your VCS to the subdirectory gradle_user_home. | The partition/drive should have enough space/speed to hold your sources, a deployed server and the size of a deployed server caches for remote repositories.
|
2 | For Gradle Tools version >= 2.0: Create an empty directory to contain your development environment. Check out the developer home from your VCS to the subdirectory developer_home (as generated at <sources>/devops/developer/<project name> in Cookbook - Setup CI Infrastructure (valid to GradleTools 2.1)). | The partition/drive should have enough space/speed to hold your sources, a deployed server and the size of a deployed server caches for remote repositories. |
3 | Open a console, change into the checked out folder and execute gradle_environment.bat. | This sets several environment variables, including GRADLE_USER_HOME , COMPONENTSET , ASSEMBLY, SERVER, REPO inside this console. We will refer to this console as developer console. Keep using it through the remaining steps. |
4 | Check out your system component set to the folder pointed to by | |
5 | Check out your assembly to the folder pointed to by %ASSEMBLY% using your VCS. | |
6 | Go to <COMPONENTSET> (run | This builds your system component sets. The results can be found at <COMPONENTSET>\<component>\target(replaces IS_TARGET). It also packages the results and publishes them to your local repository at <REPO>. This is necessary to offer a unified deployment across development and production. The |
7 | Go to <ASSEMBLY> (run | This creates the file <ASSEMBLY>\environment.properties.sample. It is a template for all deployment configuration required to deploy a server for development. |
8 | Copy <ASSEMBLY>\environment.properties.sample to <ASSEMBLY>\environment.properties and fill in the gaps/make necessary adjustments. | At least adjust the following sections: |
9 | Go to <ASSEMBLY> (run cdAssembly )* and run gradlew deployServer | This deploys the assembly as your test server into <SERVER>. Note that IS_HOME now resides at <SERVER>\local and IS_SHARE at <SERVER>\share. |
10 | Run as adminstrator/with root privileges (as requested in the console output): <SERVER>\postInstall\installServices.bat | This creates the services. The services run under your user. You will be prompted for your password. |
11 | Go to <ASSEMBLY> (run
| See the Recipe: Initialize the Database for details. |
12 | At the developer console go to your Intershop Studio installation and run (or run | It is important to start Intershop Studio from a developer console with all environment variables set. No more initial configuration in the preference menu is necessary. Using Gradle requires Intershop Studio version >= 4.3.4. You may run into a problem when opening the preference dialog the first time, see the box Issue with Intershop Studio Preferences below. |
13 | Import the system component set using the wizard Component Set projects into Workspace | See the section Intershop Studio on how to import a component set. |
* Commands provided by gradle_environment.bat created with Gradle Tools >= 2.0
Starting services and the application server are out of scope of this document.
# | Action | Explanation |
---|---|---|
1 | Check if the minimum System Requirements are fulfilled.
Additionally to the general requirements:
| For gradle_environment.sh created with Gradle Tools >= 2.0: The gradle_environment.sh (see next step) by default expects the Intershop Studio executable to be installed at /opt/intershop/IntershopStudio/IntershopStudio. If your Intershop Studio is located elsewhere adapt the line defining openStudio in gradle_environment.sh accordingly. |
2 | For Gradle Tools version 1.0-1.1: Create an empty directory to contain your development environment. Check out preconfigured Gradle user home (gradle_user_home) from your VCS to the subdirectory gradle_user_home. | The partition/drive should have enough space/speed to hold your sources, a deployed server and the size of a deployed server caches for remote repositories.
|
2 | For Gradle Tools version >= 2.0: Create an empty directory to contain your development environment. Check out the developer home from your VCS to the subdirectory developer_home (as generated at <sources>/devops/developer/<project name> in Cookbook - Setup CI Infrastructure (valid to GradleTools 2.1)). | The partition/drive should have enough space/speed to hold your sources, a deployed server and the size of a deployed server caches for remote repositories. |
3 | Open a console, change into the checked out folder and execute: | This sets several environment variables, including GRADLE_USER_HOME , COMPONENTSET , ASSEMBLY, SERVER, REPO inside this console. We will refer to this console as developer console. Keep using it through the remaining steps. |
4 | Check out your system component set to the folder pointed to by | |
5 | Check out your assembly to the folder pointed to by $ASSEMBLY using your VCS. | |
6 | Go to<COMPONENTSET> (run | This builds your system component sets. The results can be found at <COMPONENTSET>/<component>/target(replaces IS_TARGET). It also packages the results and publish them to your local repository at <REPO>. This is necessary to offer a unified deployment across development and production. The |
7 | Go to <ASSEMBLY> (run cdAssembly )* and run ./gradlew | This creates the file <ASSEMBLY>/environment.properties.sample. It is a template for all deployment configuration required to deploy a server for development. |
8 | Copy <ASSEMBLY>/environment.properties.sample to <ASSEMBLY>/environment.properties and fill in the gaps/make necessary adjustments. | At least adjust the following sections: |
9 | Go to <ASSEMBLY>(run cdAssembly )* and run ./gradlew deployServer | This deploys the assembly as your test server into <SERVER>. Note that IS_HOME now resides at <SERVER>/local and IS_SHARE at <SERVER>/share. |
10 | Run as adminstrator/with root privileges (as requested in the console output): <SERVER>/postInstall/installServices.sh | This creates the init.d-scripts. The services will run under your user. |
11 | Go to <ASSEMBLY> (run
| See the Recipe: Initialize the Database for details. |
12 | At the developer console go to your Intershop Studio installation and run (or run | It is important to start Intershop Studio from a developer console with all environment variables set. No more initial configuration in the preference menu is necessary. Using Gradle requires Intershop Studio version >= 4.3.4. You may run into a problem when opening the preference dialog the first time, see the box Issue with Intershop Studio Preferences below. |
13 | Import the system component set using the wizard Component Set projects into Workspace | See the section Intershop Studio on how to import a component set. |
* Commands provided by gradle_environment.bat created with Gradle Tools >= 2.0
Starting services and the application server are out of scope of this document.
Gradle tools version 1.0-1.1:
The Gradle user home (<GRADLE_USER_HOME>)
is a folder that stores all files associated with a certain development context. It contains:
Gradle tools version >= 2.0:
The developer home is a folder containing an environment script (gradle_environment.bat/ gradle_environment.sh), see next section. The developer home is checked into the VCS.
The Gradle user home (<GRADLE_USER_HOME>)
is a folder that stores temporary files associated with a certain development context. It contains:
The Gradle user home is not checked into the VCS.
When setting up your CI environment a script gradle_environment.bat | gradle_environment.sh is generated. This script configures the directory layout you work with, by setting a few environment variables.
We refer to a console with these environment variables in place as a developer console. Run all gradlew
commands and Intershop Studio from a developer console.
To start a developer console:
The following table lists the most important environment locations provided from gradle_environment.bat | gradle_environment.sh represented by environment variables.
Name | Contents | Environment variable |
---|---|---|
Gradle user home | Developer configuration in gradle.properties, as well as caches for downloads from remote repositories | GRADLE_USER_HOME |
System Component set directory | VCS working copy of component set sources | COMPONENTSET |
Assembly directory | VCS working copy of assembly sources | ASSEMBLY |
Server directory | Server deployed for manual and automatic testing (contains both IS_HOME and IS_SHARE as subfolders) | SERVER |
Javadoc directory | Javadoc of cartridges (excluding own cartridges) | JAVADOC |
Intershop Studio workspace | Workspace data | WORKSPACE |
Local repository | Locally published components – used internally as a deployment source | REPO |
These environment variables are partly for your convenience and partly to configure Gradle/Intershop Studio.
with Gradle Tools >= 2.0:
The environment script provides the following alias commands:
Command | Function |
---|---|
cdRepo | Change directory to local repository |
cdSet | Change directory to project component set |
cdAssembly | Change directory to project assembly |
cdServer | Change directory to server directory |
cdDoc | Change directory to java doc directory |
openStudio | Open Intershop Studio |
Running gradlew publish
in <COMPONENTSET>
actually consists of of two steps, first build, then publish. It is necessary to not only build components, but also to publish them to a repository (e.g., copy them to a folder with predefined structure) for two reasons:
compile group: 'com.intershop', name: '<name>'
in a component's build.gradle file. They must be resolved from (a local or remote) repository.compile project(':<name>')
. (Project dependencies resolved directly from the target directories.)The useSetAsFilter
task of the component set adds a filter property in the <GRADLE_USER_HOME>/gradle.properties:
filter.<organization of component set>.<name of component set> = <version>-local
This property ensures that the assembly process uses local versions for all cartridges from this component set. (So you deploy local versions of these in the initial and later re-deployments.) See also Concept - Gradle Build Tools | Configuring Dependency Versions.
The developer deployment first generates a <SERVER>/settings.gradle file from the environment.properties configuration. Based on this file it then runs standard deployment procedure as describes in Concept - Gradle Deployment Tools specifying the host type all
, e.g., deploying all host types of the assembly. As deployment source it uses the repositories declared in your corporate plugin as well as your local repository at <REPO>.
Besides being based on the same deployment scripts, the developer deployment is also tailored for development in a few ways:
The properties IS_SOURCE
in <SERVER>/local/intershop.properties and cartridges.source
in <SERVER>/share/system/cartridges/cartridgelist.properties. This ensures that the application server uses the cartridges checkout directory to load static artifacts and classes.
development
(i.e., that are not included in the production
environment), like the dev_lilith cartridge .
Open debug ports in tomcat.bat / tomcat.sh and dbinit.bat / dbinit.sh as configured in <ASSEMBLY>/environment.properties. The configuration of debug ports depends on the configuration of the source directories in the gradle.properties in the developer home.
The post-install scripts perform all deployment operations for which administrator / root privileges are required. Currently this is only the creation of services. The developer deployment uses the current user as deployment user and– on Windows– also as user for executing the deployed applications / services. Therefore, you have to enter your password for every service to be created.
After the post-install scripts, running services / applications is completely up to you and works mostly as before. If starting any service fails on Windows, please refer to the Recipe (Windows) Starting a Service Fails in the Cookbook - Gradle Deployment Tools (7.4 CI - ICM 7.7)
Intershop Studio will find your sources, the deployed server etc. by relying on the environment variables in a developer console. Therefore, start Intershop Studio from a developer console. No more initial configuration in the preference menu is necessary.
To import your system component set into the workspace:
To import your assembly into the workspace, use the same steps, but instead select the import wizard Gradle | Gradle Project. I.e:
Note
Issue in Intershop Studio Preferences
There is a known issue in Intershop Studio 4.3.4:
When accessing the preference dialog (menu Window | Preferences) and the preference page Intershop Studio there may be red cross next to Development Gradle Properties. Hovering of this cross a text similar to the following will be displayed: The key 'serverDirectory' is not found in the properties file. Also in this case you cannot select another preference page on the right nor close the dialog with the OK button.
First: Make sure that you started Intershop Studio from a developer console with all environment variables set.
If you have and the problem still occurs, you may have run into the issue ISTUDIO-123. The issue is fixed in higher versions. For a workaround in the meantime, please see the steps below the picture.
This problem is mostly cosmetic and will not affect you in your work. (Intershop Studio will find serverDirectory
using environment variables set by the gradle_environment.bat/gradle_environment.sh.)
To be able to work with the preference dialog again, use the following workaround:
The preference page General will be selected and you can continue working.
Avoid selecting the preference page Intershop Studio. (If you select it, you will have to repeat the workaround.) It is not necessary to configure anything there.
Preference pages nested under Intershop Studio are not affected and can and should still be used.
The following diagram shows how data flows between directories (blue) during the different steps (red).
Note
The application server can now read (denoted by dotted lines) static artifacts like ISML templates, pipelines, queries etc directly from the SVN working copies. No more linking / copying is necessary. (Also it reads classes directly from the target directories.)
Gradle tasks are the units of work you can trigger. This recipe describes how. For an introduction beyond this recipe, please refer to the Gradle user guide.
You may run Gradle tasks using Intershop Studio or the console. Generally you have to:
The assembly, all cartridges and the system component set itself are Gradle projects. The component set and the cartridges form a Gradle multi-project build. The component set works as the root project and cartridges are (direct) child-projects of the component set.
Tasks can have dependencies to other tasks. Executing a certain task will always also execute its dependencies.
You may specify multiple tasks to run in one execution of Gradle. The order of depending tasks is mostly determined automatically by Gradle.
Tasks independent of each other are executed in the order in which you are passing the tasks in.
Note
Be aware that the order of independent tasks is important. E.g., executing a cleaning task after the build task leads to an empty directory.
In Intershop Studio each Gradle project is represented by an Eclipse project.
To execute tasks in a cartridge/assembly/component set:
You may also specify additional parameters in the dialog.
To reuse and switch between multiple configurations per project (e.g., different deploy or database tasks in the assembly), give them different names. Thus they can be found in the list of the external tool configurations .
To execute tasks via Console:
gradlew :<task1> :<task2>
, e.g., gradlew :deployServer :importDump
./gradlew :<task1> :<task2>
, e.g., ./gradlew :deployServer :importDump
Syntax difference on Linux
In the remainder of this section we will ignore the minor difference between execution on Linux and Windows. Always run ./gradlew
instead of gradlew
if you work on Linux.
To execute a task in a certain cartridge (i.e., a child-project), pass in :<cartridge>:<task>
, e.g., gradlew :core:clean :core:build
.
You can also combine tasks from different cartridges, e.g., gradlew :core:build :bc_foundation:build
.
Tasks names with or without colon
To execute a task in all cartridges of the component set execute gradlew <task>
(without colon), e.g., gradlew build
. Running the command with a colon, e.g., gradlew :build
, leads to an error if the task does only exist for cartridges, but not for the component set:
FAILURE: Could not determine which tasks to execute. * What went wrong: Task 'build' not found in root project 'projectComponentSet'. * Try: Run gradlew tasks to get a list of available tasks.
The following is a loose collection of helpful hints to get you started with Gradle. Run all of them in a developer console.
To display all cartridges in the component set execute the following inside <COMPONENTSET>:
gradlew :projects
To display tasks of a (root) project (component set or assembly):
gradlew :tasks
To display the tasks of a certain subproject (e.g., cartridge) run:
gradlew :<name>:tasks
To find out which tasks are actually going to be executed (e.g., which dependencies are automatically pulled in) and in which order:
gradlew <tasks> --dry-run
Note
The installation of the Oracle database software and database instance especially a XE instance is not part of the Intershop deployment tools, but is performed by the Oracle setup routine. The Guide - Setup Oracle XE as Intershop Development Database (valid to 7.10) describes, how the Oracle XE edition as well as Intershop 7 need to be configured for use as development database.
The database must be initialized before testing (or as part of the test, i.e., to see if the database can be initialized).
There are two ways to initialize your database.
You may import the database dump generated for the released version of your assembly. This is only useful if your local changes have no effect on the initial database state. To import the dump run the task importDump
on the assembly.
The release version from which the dump is taken is determined by the property dump.<assembly organization>.<assembly name>
in <GRADLE_USER_HOME>/gradle.properties. This way rerunning the importDump
task always imports the same dump, unless you change the property.
The dump property is automatically created upon first run of the importDump
task. To update the property to the latest released version run the updateDumpVersion
task.
You may run the DBInit through assembly. To do so:
gradlew dbinit -PskipDeployment
./
gradlew dbinit -PskipDeployment
The task dbinit
has a dependency to deployServer
, i.e., if you execute the DBInit the server is automatically be deployed before that. If you want to run dbinit
without prior execution of deployServer
, pass in -PskipDeployment
.
The dump is downloaded from the release repository and handed over to ant import
at <SERVER>/local/tools/misc.
Also branding installations, which are usually created by running DBInit are downloaded from the release repository and extracted into <SERVER>/share/sites.
You can still use ant import
at <SERVER>/local/tools/misc to import other dumps.
Quick Start
The Intershop delivery/DVD comes with two dumps that might be useful until your own assembly was built by a CI server.
Find them in the delivery/on the DVD at:
You can also find them in a repository (like a Nexus) filled with the delivery contents in a similar path.
To use them:
ant import
The command first executes ant dbschema-clean
at <SERVER>/local/tools/misc to purge your database account. After that it executes dbinit --classic
in <SERVER>/local/bin, i.e., a full DBInit over all cartridges without interactions.
You may still run these commands manually if you like - or need to pass in other options.
After the initial setup, the developer changes the sources of the component set. This may happen because of changes made by the present developer or updates to the VCS working copies of assembly and component set. The developer must be able to see this changes in the deployed server.
Depending on the kind of change, different actions are necessary to make the changes visible in the running server.
Kind of change | Action |
---|---|
The changed code artifact resides in <COMPONENTSET>/<cartridge>/staticfiles/cartridge. | Reload the page. The application server automatically reloads the files directly from this directory (and recompile ISML templates if necessary). |
The changed code artifact is a Java class. | Rebuild the affected cartridges and restart the application server. The application server loads the classes from <COMPONENTSET>/<cartridge>/target/classes. |
The changed code artifact resides in <COMPONENTSET>/<cartridge>/staticfiles/share. | Publish and redeploy the affected cartridge(s) and restart the application server / rerun the dbinit. (Publishing automatically includes rebuilding.) |
You are unsure which kinds of changes have been made - e.g., you updated your VCS working copy. | Publish and redeploy the component set. You may also want to reinitialize your database, see Recipe: Initialize the Database. |
Changes in the assembly, including changes in <ASSEMBLY>/environment.properties. | Redeploy the whole assembly. You may also want to reinitialize your database, see Recipe: Initialize the Database. |
See discussion below for how to perform these actions.
Please, refer to the Recipe: Run Gradle Tasks on how to run these tasks. This recipe also mentions how to execute a task on multiple or all cartridges at once.
To rebuild (e.g., recompile) a cartridge, run the build
task on that cartridge.
The buildDependents
task builds the cartridge itself and all cartridges in your component set that depend on it. This is useful to see if Java changes cause compilation errors in depending components.
When not cleaning the build results before building / publishing, Gradle performs an incremental build. Gradle only re-execute Gradle tasks whose inputs have changed (or whose outputs have been tampered with). This is somewhat safer and more reliable than re-executing an Ant build. Using the non-cleaning, incremental build should suffice for developers most of the time.
To execute a clean build run the tasks clean
and build
on the cartridge(s).
Using these tasks does not touch the contents of your local repository. If you later redeploy your changes, make sure to publish them before.
To republish a cartridge to your local repository, run the publish
task on that cartridge. This overwrites the local version of that cartridge inside your local repository at <REPO>.
All deployment tasks are run on the assembly project. Before you can deploy any change, you must have published it.
To redeploy all cartridges of your component set run the task deployCartridges
.
To redeploy only a few cartridges:
<ASSEMBLY>
gradlew deployCartridges -Pcartridges="<space separated list of cartridges>"
, e.g., gradlew deployCartridges -Pcartridges="core bc_foundation"
./gradlew deployCartridges -Pcartridges="<space separated list of cartridges>"
, e.g., ./gradlew deployCartridges -Pcartridges="core bc_foundation"
To redeploy the whole server run the task deployServer
.
Note
The deployment also works incrementally and touches only files that have been changed (it does not delete all files). In most cases, it should be possible to keep services / the application server running. Restart after the deployment, if the application server only reloads the changed files upon restart (like for most Java classes).
Running the post-install scripts again is not necessary after redeployment.
A developer needs to execute and debug tests.
There are currently three ways to execute tests.
This should be the preferred way to execute tests for the developer.
Before being able to run the system or integration tests, you must set up your workspace by:
To run or debug a single test:
To run multiple tests that are not in the same Java package, please create a JUnit4 test suite first and run that suite.
This way of execution applies to all types of tests.
You may run all unit tests of a cartridge (i.e., not a _test-cartridge) by running the Gradle test
task on that cartridge. A report is generated per cartridge at <COMPONENTSET>/<cartridge>/target/reports/tests/index.html.
You may also run the Gradle test
task on the component set. This executes the test
tasks of all cartridges and generates an overall report. The report can be found at <COMPONENTSET>/target/reports/allTests/index.html.
Note
This approach only executes unit tests!
You may run multiple integration or system tests with the Intershop Test-Runner by:
ES<n>|...
(e.g., ES1|D:\is7\trunk\
), run <SERVER>/local/bin/environment.bat.ant test
.Unit tests are not available in the test runner anymore! See the discussion below for rationale.
There are three kinds of tests that are treated differently.
Unit tests are tests that require nothing but a properly populated class path to run. Especially, they cannot require a pre-created files or directories (like through deployment) or a database. (They may however start up a pretty complete server in their initialization - as long as this server does not access any file system resources, like configuration files.)
Super classes/annotations for Unit tests are:
junit.framework.TestCase
(legacy test cases written for JUnit version <= 4)
@RunWith
annotation (newly written test cases starting with JUnit 4)Unit tests are located in the same cartridge as the functionality they test.
Run unit tests using:
Unit tests are not deployed
Unit tests are solely for execution by the developer and during build by the continuous integration server. Since unit tests are not needed after the build process any longer, they are not packaged up and cannot be deployed.
A consequence of this simplification is that they are not available for execution in the test runner any more.
Integration tests require a fully deployed server and are executed within that server, so they have direct access to the classes and objects in the JVM.
Super classes for Integration tests are:
com.intershop.tools.etest.server.UnitTestCase
(sic!)com.intershop.tools.etest.remote.CAPITestCase
Integration tests are located in the accompanying test cartridge of the cartridge being tested (bc_pricing_test for bc_pricing).
Run integration tests using:
System tests run outside the server and access it via any remote interface (e.g., via HTTP). Technically they are run like unit tests, but they require additional Java properties to know how to connect to a server.
Super classes for system tests are:
tests.remote.com.intershop.testfw.util.ucm.UCMHTTPTestCase
System tests are currently all located in ucm_tests in component set tests.
Run integration tests using:
Developers need to add new cartridges to an existing component set.
To add a new cartridge to an existing component set perform the following overall steps:
Please see discussion below for details on how to perform these steps.
It is not necessary to register the cartridge inside the component set in any way. Instead all sub-folders not explicitly excluded in <COMPONENTSET>/settings.gradle are treated as components and included in the build. This way upon commit they are also included in the build of the continuous integration server automatically.
Other non-Gradle related steps, like adding the cartridge to an application type may still be necessary.
Note
Unique Cartridge Names
Besides publishing cartridges with a qualified name, e.g., with an organization and a name, for legacy reasons the unqualified names still have to be unique. I.e., you cannot create a cartridge with the organization com.customer
and name core
, because there already is core
in com.intershop
. Instead keep adding prefixes to the name like customer_core.
The build.gradle file of a cartridge is both, the build script and the build configuration file for that cartridge. Reusable build functionality comes in Gradle build plugins. Different kinds of artifacts are handled by different plugins. The Gradle build will fail, if you apply a plugin, but there are no matching source files to process.
Intershop Studio generates an initial build.gradle file that is suitable for cartridges containing Java source code and static files. Please refer to Cookbook - Gradle Build Tools | Configure the Build of a Component / Cartridge on how to configure your build.gradle file.
Note
Cartridges that contain ISML templates must declare a few dependencies:
dependencies {
compile group:
'com.intershop'
, name:
'tools'
compile group:
'com.intershop'
, name:
'isml'
compile group:
'com.intershop'
, name:
'servletengine'
compile group:
'com.intershop'
, name:
'core'
}
If you fail to do so an error similar to this one will occur when building / publishing the component set:
... Execution failed for task ':<cartridge>:isml2classMain' > taskdef class com.intershop.beehive.isml.capi.ISML2JSP cannot be found using the classloader AntClassLoader ....
When declaring dependencies you need to distinguish between:
compile project(':<cartridge name>')
inside the dependencies block.compile group: '<cartridge organization>', name: '<cartridge name>'
The following example demonstrates the different declarations.
dependencies { compile group: 'com.intershop', name: 'tools' compile project(':customer_base') }
As already used from dependency management with Ivy the compile classpath is resolved intransitively: If you specify a dependency to the core cartridge you will not automatically have a dependency to tools. So you will not have tools in your classpath unless you declare the dependency explicitly.
No versions in build.gradle file
Note that external dependencies do not have to declare versions directly. Instead Intershop recommends to declare them using version and filter properties in a gradle.properties file. See Concept - Gradle Build Tools | Configuring Dependency Versions for details.
Please follow the Recipe in Cookbook - Gradle Assembly Tools | Add Cartridges to an Assembly.
To let the changes take effect locally, publish the component set and redeploy your assembly, as described in Recipe: Make Changes Effective on the Server. Make sure to publish the whole system component set by running the publish
task on the system component set, not just the added cartridge.
The developer needs to remove the development environment when finished to free system resources.
undeploy
on the assembly. This first execution generates an uninstall script for the services.undeploy
on the assembly again. This purges your server directory.The Gradle cache located <GRADLE_USER_HOME>/cache currently grows indefinitely and may eventually fill the hard disk.
On Windows:
gradlew --stop
.SET GRADLE_USER_HOME=%USERPROFILE%\.gradle
.gradlew --stop
(see discussion for why this has do be done twice).
GRADLE_USER_HOME
by running gradle_environment.bat
.On Linux:
./gradlew --stop
.export GRADLE_USER_HOME=$HOME/.gradle
../gradlew --stop
(see discussion for why this has do be done twice).
GRADLE_USER_HOME
by running gradle_environment.sh
.The Gradle cache contains:
Gradle has no feature for selectively cleaning the artifact cache so far: http://forums.gradle.org/gradle/topics/managing_artifact_cache_growth.
In the meantime, you have to revert to completely deleting the Gradle cache occasionally as described above. The disadvantage of this approach is that all artifacts required for further build and deployment processes will be downloaded again.
Before deleting the cache directory all processes that hold file handles into it must be stopped, i.e., all Gradle daemons. You can do so by calling gradlew --stop
.
Note
This command only stops daemons started with the Gradle user home specified by GRADLE_USER_HOME
environment variable. Due to a bug in the Gradle Tooling API (http://issues.gradle.org/browse/GRADLE-2414) IntershopStudio will partially use the default Gradle user home at <OS_USER_HOME>/.gradle. That is why you have to run the command twice with different values of GRADLE_USER_HOME
.
You can see all running Gradle daemons (not just of the current Gradle user home) by running jps
. Example of output:
19452 lilith.jar 22244 Jps 17448 GradleDaemon 13520 15852 GradleDaemon 16772 3468 GradleDaemon 22276