**Source URL:** https://general.veevavault.dev/regulatory/vault-sdk/getting-started/deploy-code.md

# Deploy Custom Code



In this step, you will:

* Deploy custom code to your Vault

* Learn how to install & use the [Vault Java SDK Maven Plugin](https://github.com/veeva/vaultjavasdk-maven-plugin) to deploy code

* Run your deployed code in your Vault

## Prerequisite: Install Maven {#prerequisite-install-maven}

If you're using IntelliJ®, Maven is already bundled with your installation. If you're using another IDE, you may need to manually install Maven.

## Deploy Code with the Maven Plugin {#deploy-code-with-the-maven-plugin}

<Steps>
1. Navigate to `vsdk-helloworld-getting-started\src\main\resources` and open `plugin_settings_file.json`.

2. Replace `firstname.lastname@example.com` with your Vault user name.

3. Navigate to `vsdk-helloworld-getting-started\src\main\resources` and open `vapil_settings_file.json`.

4. Update the `vaultUsername`, `vaultPassword`, and `vaultDNS` values with your login information.

5. From the righthand IntelliJ® sidebar, open the **Maven** menu and navigate to **vsdk-hellowork > Plugins > vaultjavasdk**.

6. Double click on the `vaultjavasdk:package` Maven goal. This creates the `.vpk` file which contains your code changes. <ThemeImage srcLight="/images/sdk/getstarted/MavenPlugin.png" srcDark="/images/sdk/getstarted/MavenPlugin.png" alt="Executing the vaultjavasdk:package Maven goal."></ThemeImage>

7. Verify that this maven goal created a **deployment** folder at the root directory, with a `vaultpackage.xml` file and a `.vpk` file. <ThemeImage srcLight="/images/sdk/getstarted/IntelliJDeploymentFolder.png" srcDark="/images/sdk/getstarted/IntelliJDeploymentFolder.png" alt="The deployment folder in IntelliJ."></ThemeImage>

8. Run the `vaultjavasdk:deploy` Maven goal from the **Maven** sidebar menu to deploy the `.vpk` to Vault. Deploying may take a minute. You will receive an email when Vault completes the deployment.

</Steps>

## Verify Deployment: Run Code {#GS_Verify_Deployment}

Now that we’ve deployed the new trigger code for the `AFTER_INSERT` event, let’s run it again and make sure that the changes work as expected.

<Steps>
1. [Log in](https://login.veevavault.com/) to your Vault.

2. Navigate to **Business Admin > Objects > vSDK Hello World**.

3. Click **Create**.

4. Enter someone else’s name in the **Name** field.

5. Click **Save**. This time, your trigger fires on the `AFTER_INSERT` event and we’re getting an error message! <ThemeImage srcLight="/images/sdk/getstarted/ErrorHandlingStrategyError.png" srcDark="/images/sdk/getstarted/ErrorHandlingStrategyError.png" alt="Error message after firing the trigger on AFTER_INSERT."></ThemeImage>

</Steps>
When saving records using Vault Java SDK, you must specify an error handling strategy. Because the `AFTER_INSERT` event is saving the record, writing code for this event requires an error handling strategy.
You can learn more about error-handling and how to fix this error in the next tutorial: [SDK Debugger](/vault-sdk/sdk-debugger/).

Congratulations, you’ve finished the Getting Started!

To recap what we’ve learned, you now know how to:

* [Deploy a VPK to your Vault](/vault-sdk/getting-started/vault-setup/), which copies configuration from one Vault to another

* [Run a deployed record trigger in your Vault](/vault-sdk/getting-started/run-record-trigger/), understanding the record event that triggered your trigger

* [Set up your development environment](/vault-sdk/getting-started/development-setup/) to connect to your Vault

* Understand how to [write code for different record events](/vault-sdk/getting-started/write-custom-code/)

* Deploy custom code changes to your Vault with the [Maven Plugin](/vault-sdk/deploying-code/)

## Next Steps {#next-steps}

* Learn how to fix this error in the [Vault Java SDK Debugger Tutorial](/vault-sdk/sdk-debugger/)



---

**Previous:** [Write Custom Code](/regulatory/vault-sdk/getting-started/write-custom-code)  
**Next:** [SDK Debugger](/regulatory/vault-sdk/sdk-debugger)