Configuration
This is an open source plugin
Plugin Requirements
- Java JDK 1.7
- Gradle 2.0 or greater
- Operation System:
- Windows 7
- Linux Ubuntu
- Mac OS
- build.gradle file
- gradle.properties file (Optional)
- credentials.dat file
- User account in a Salesforce Organization and the corresponding security token
Tentative files configuration for User
Files Gradle
- build.gradle has the configuration of gradle for user.
- gradle.properties has values that build.gradle will use.
- credentials.dat has all credentials to use.
build.gradle
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.fundacionjala.gradle.plugins.enforce:enforce-gradle-plugin:1.1.5'
}
}
apply plugin: 'enforce'
enforce {
srcPath = 'src'
deleteTemporaryFiles = true
}
gradle.properties
credentials.dat
{
"default": {
"username": "user@org.com",
"password": "mypassword",
"token": "2B9UvHKK2E1ky1EkkYBPFvbLM",
"sfdcType" : "login",
"type": "ecrypted"
}
}
Setup Salesforce organization credentials
Credential support
Managing of credentials can create and update credentials in 'credentials.dat' file which is located in HOME directory. A format was shown in Files gradle that is on the last point.
'AddCredential task' creates a credential in 'credentials.dat' file located in HOME directory it is saved as encrypted by default and its 'sfdcType' field is saved with a default login value.
'UpdateCredential task ' updates a credential by key from 'credentials.dat' file.
Note: Notice that the example uses the “default” key which by convention is the one to be used by default when a task is executed. You can have several entries to different salesforce accounts but each entry needs to have an unique key.
Project gradle tasks
The gradle project contains tasks that will help on development and packaging. You have to execute the gradle tasks from the project directory. It will show you all tasks runnable from the root project.
Command:
Output:
Build Setup tasks
- init - Initializes a new Gradle build. [incubating]
- wrapper - Generates Gradle wrapper files. [incubating]
Credential Manager tasks
- addCredential - You can add a credential
- updateCredential - You can update a credential
Deployment tasks
- deploy - This task deploys all the project
- undeploy - This task removes all components in your organization according to local repository
- update - This task deploys just the files that were changed
- upload - This task uploads all specific files or folders as the user wants
File Monitor tasks
- reset - Reset the file monitor
- status - You can display elements that were changed
Help tasks
- Dependencies - Displays all dependencies declared in the root project ‘user’.
- DependencyInsight - Displays an insight into a specific dependency in the root project ‘user’.
- Help - Displays a help message
- Projects - Displays the sub-projects of the root project ‘user’.
- Properties - Displays the properties of the root ‘user’
- Tasks - Displays the tasks runnable from the root project ‘user’.
Package Management tasks
- installPackage - Installs a package to an organization.
- uninstallPackage - Uninstalls a package from an organization.
Retrieve tasks
- retrieve - This task recover specific files from an organization
Test tasks
- runTest - This task runs unit tests and it also generates results of unit test and coverage
Utils tasks
- execute - This task executes apex code from a file or inline code