Note
|
Version 5 of this plugin will only work with Gradle 5 and JDK 8! |
This collection of plugins adds special release functionality and encapsulates specific configurations and task dependencies. It includes plugins for the creation of an escrow package, for the configuration of JavaDoc and the configuration of publishing.
It creates a zip file of the root project after the build. It is possible to exclude files and directories additional for the prepared default excludes.
To use the Gradle escrow plugin. include the following in your build script:
plugins {
id 'com.intershop.gradle.escrow-plugin' version '5.0.0'
}
escrow {
sourceGroup = 'publishing group of the escrow package'
}
This plugin can be applied only to the root project. It produces a zip package with all the sources and without Gradle wrapper directory, which will be published to the specified repository.
Property |
Type |
Default value |
Description |
runOnCI |
|
false |
This configuration must be true, if the project is used on a CI server. |
sourceGroup |
|
|
Group or organization of the published ESCROW source package |
classifier |
|
'src' |
Specify the classifier of this artifact. |
[ <buildDir of the root project>, "*/<buildDir of the root project>", '.gradle', '.svn', '.git', '.idea', '.eclipse', '.settings', '**/.settings/**' ]
This list can be manipulated with the following methods:
Method |
Type |
Parameter |
Description |
exclude |
|
String |
Add an additional exlude pattern to the exclude list. |
excludes |
|
List<String> |
Add all elements of the parameter list to the exclude list. |
setExcludes |
|
List<String> |
Reset the default exclude list with the parameter list. |
The configuration and the execution of tasks depends on the version number. Release versions without a "SNAPSHOT" extension will be published to a release repository, otherwise the artifacts will be published to the snapshot repository. It must be applied also to each subproject. === Usage To use the Nexus Publish configuration plugin, include the following in your build script:
plugins {
id 'com.intershop.gradle.simplepublish-configuration' version '5.0.0'
}
The behaviour of the plugin is controlled by environment variables, so that the plugin can be applied to the project without exceptions. This kind of configuration is also easier to maintain on the CI server.
System variable or Java system property | Project property | Description |
---|---|---|
RUNONCI |
runOnCI |
This configuration must be true, if the project is used on a CI server. The version will be extended with '-LOCAL', if this value is false. |
SNAPSHOTURL |
snapshotURL |
Snapshot URL for publishing of snapshot builds |
RELEASEURL |
releaseURL |
Release URL for publishing of release builds without staging. |
REPO_USER_NAME |
repoUserName |
The username with the correct role/permissions for transfer |
REPO_USER_PASSWD |
repoUserPasswd |
The password of the user. |
SNAPSHOT_RELEASE |
snapshotRelease |
The version will be extended with '-SNAPSHOT' and snapshot repositories are used if this value is set to 'true'. |
It applies the following plugins to the root project:
Gradle Artifactory Plugin
Gradle Plugin for Editing Atlassian Jira Issues
Buildinfo Plugin These properties are used for the configuration of Gradle Artifactory Plugin.
The ivy pattern configuration is used from
'Repository Configuration Init Script Plugin'*[:
It requires, that the SCM Version Plugin is applied to the project.
The configuration and the execution of tasks depends on the version number. The editing of Jira issues will be executed only for release versions without a "SNAPSHOT" extension. Furthermore the snapshot repository key is used if the version is a snapshot version.
Note
|
The behaviour of the plugin is changed with version 3.5. A task 'releaseLog' is added by this plugin to project tasks. This task starts the creation of a change log and sends the version of the build to Jira, if the project version does not end with snapshot. Otherwise the task has not function and is always 'up to date'. |
To use the Artifactory publish configuration plugin, include the following in your build script:
plugins {
id 'com.intershop.gradle.artifactorypublish-configuration' version '5.0.0'
}
artifactory {
publish {
// for ivy publications
repository {
maven = false
}
// list of publication names
defaults {
publications('ivy')
}
}
}
The behaviour of the plugin is controlled by environment variables, so that the plugin can be applied to the project without exceptions. This kind of configuration is also easier to maintain on the CI server.
The target repository key for publishing depends on the version number.
- Snapshots - version ends with SNAPSHOT - will be published to the snapshot repository.
- All other artifacts will be published to the release repository.
It is necessary to specify all publication names for publishing with Artifactory Gradle plugin.
Furthermore it is necessary to specify the kind of publication. For ivy publications it is necessary to set publish.repository.maven
to false
.
For release versions the field 'Fix Version/s' JIRA issues will be extended with the current build version. It is possible to change the field with the project property 'jiraFieldName'.
System variable or Java system property | Project property | Description |
---|---|---|
RUNONCI |
runOnCI |
This configuration must be true, if the project is used on a CI server. |
ARTIFACTORYBASEURL |
artifactoryBaseURL |
The base url of the used Artifactory server. |
SNAPSHOTREPOKEY |
snapshotRepoKey |
Repository key for publishing of snapshot builds |
RELEASEREPOKEY |
releaseRepoKey |
Repository key for publishing of release builds. |
ARTIFACTORYUSERNAME |
artifactoryUserName |
The username with the correct role/permissions for transfer |
ARTIFACTORYUSERPASSWD |
artifactoryUserPASSWD |
The password of the user. |
These settings are dublicated from the Gradle Plugin for Editing Atlassian Jira Issues |
||
JIRABASEURL |
jiraBaseURL |
The base url of Atlassian Jira, e.g. http://jira/jira |
JIRAUSERNAME |
jiraUserName |
The username with the correct role/permissions for editing issues |
JIRAUSERPASSWD |
jiraUserPASSWD |
The password of the user. |
jiraFieldName |
The version string will be set to this field. Default: 'Fix Version/s' |
The properties can be set with files from an other source management system.
source /dev/stdin <<< "$(curl -s https://gitlab/user/build-configuration/raw/master/configuration.file?private_token=token)"
sh ./gradlew clean test publish -s
# configuration for assembly tests
ORG_GRADLE_PROJECT_buildEnvironmentProperties=${WORKINGDIR}/environment/intershop7-release-environment.properties
ORG_GRADLE_PROJECT_testEnvironmentProperties=${WORKINGDIR}/environment/intershop7-release-environment.properties
# configuration for Artifactory publishing
ARTIFACTORYBASEURL=http://repository/artifactory
SNAPSHOTREPOKEY=libs-snapshot-local
RELEASEREPOKEY=libs-release-local
ARTIFACTORYUSERNAME=deployUser
ARTIFACTORYUSERPASSWD=deployUserPassword
# configuration for Gradle Plugin for Editing Atlassian Jira Issues
JIRABASEURL=https://jira
JIRAUSERNAME=jiraUser
JIRAUSERPASSWD=jiraUserPassword
# configuration for SCM Version Plugin
SCM_USERNAME=scmuser
SCM_PASSWORD=password
# configuration for Repository Configuration Init Script Plugin
DISABLE_LOCAL_REPO=true
# configuration for plugins
RUNONCI=true
# export variables
export ORG_GRADLE_PROJECT_buildEnvironmentProperties ORG_GRADLE_PROJECT_testEnvironmentProperties ARTIFACTORYBASEURL
export SNAPSHOTREPOKEY RELEASEREPOKEY ARTIFACTORYUSERNAME ARTIFACTORYUSERPASSWD JIRABASEURL JIRAUSERPASSWD JIRAUSERPASSWD
export SCM_USERNAME SCM_PASSWORD DISABLE_LOCAL_REPO RUNONCI
# show Gradle version
sh ./gradlew --version
Copyright 2014-2017 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.