Newer Version Available

This content describes an older version of this product. View Latest

Deploying Apex

You can't develop Apex in your Salesforce production org. Your development work is done in either a sandbox or a Developer Edition org.
You can deploy Apex using:

Compile On Deploy

Starting in Summer ‘18, each org’s Apex code is now automatically recompiled before completing a metadata deploy, package install, or package upgrade. Compile on deploy is in enabled automatically for production orgs to ensure that users don’t experience reduced performance immediately following a deployment, and you can’t disable it. For sandbox, developer, trial, and scratch orgs, this feature is disabled by default, but you can enable in Setup, under Apex Settings.

This feature causes deployments to the org to invoke the Apex compiler and save the resulting bytecode as part of the deployment. A minimal increase in deployment times can occur, but Apex doesn’t need to be recompiled on first run. So the slight increase in deployment time can prevent performance issues on first run. Consider enabling this feature in sandboxes or scratch orgs shared by multiple users for functional testing or used by continuous integration processes.

For information on setting this org preference using Metadata API, see OrgPreferenceSettings in Metadata API Developer Guide.