---
schema_version: "1"
id: 31feb6f4071335d4f1537c346d85893c9b36591108f332bedc9890d7cb768298
title: Upload Custom Policies and Publish Assets to Exchange Using the Maven Client
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/private-cloud/3.2/custom-policies.md
canonical_url: https://docs.mulesoft.com/private-cloud/3.2/custom-policies
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 9750a28da0e44a1f78ad4548e596cd3782331954351be04127017d2897c94ada
description: MuleSoft Documentation Site
release: "3.2"
latest: false
---
---
product: Anypoint Platform Private Cloud Edition
version: 3.2
---

# Upload Custom Policies and Publish Assets to Exchange Using the Maven Client

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

There are differences between Anypoint Platform Private Cloud Edition (Anypoint Platform PCE) and
the cloud version of Anypoint Platform that you must consider when uploading custom policies and
publishing assets to Anypoint Exchange using the Maven client.

See the following documentation for the cloud version of Anypoint Platform for details:

- [Getting started with Custom Policies development](https://docs.mulesoft.com/mule-gateway/policies-custom-getting-started)

- [Uploading Custom Policies](https://docs.mulesoft.com/mule-gateway/policies-custom-upload-to-exchange)

- [Maven facade API](https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/exchange-maven-facade-api-http/)

Perform the following steps for Anypoint Platform PCE:

1.  Add the server and repository sections in the `settings.xml` file to set up the archetype for
    your project:

    The following snippet shows the relevant sections:

    ```xml
        ...
        <server>
           <id>apce-repository</id>
           <username>myusername</username>
           <password>mypassword</password>
        </server>
        ...
        <repository>
           <id>apce-repository</id>
           <name>Anypoint PCE Repository</name>
           <url>https://${ANYPOINT_DNS}/exchange/maven</url>
        </repository>
        ...
    ```

    In the following examples, ${ANYPOINT\_DNS} is set to your DNS for Anypoint Platform PCE. The
    `username` and `password` must correspond with your installation.

2.  Generate the archetype:

    Follow the standard process:
    [Getting started with Custom Policies development](https://docs.mulesoft.com/mule-gateway/policies-custom-getting-started).
    For example:

    mvn -Parchetype-repository archetype:generate \\ -DarchetypeGroupId=org.mule.tools \\
    -DarchetypeArtifactId=api-gateway-custom-policy-archetype \\ -DarchetypeVersion=1.0.0 \\
    -DgroupId=${orgId} \\
    -DartifactId=${policyName} \\ -Dversion=1.0.0-SNAPSHOT \\
    -Dpackage=mule-policy

3.  Replace the `exchange.url` in the `pom.xml` file. By default, `exchange.url` points to the cloud
    version of Anypoint Platform. `maven.anypoint.mulesoft.com` must point to the Anypoint Platform
    PCE endpoint:

    <exchange.url>https://${ANYPOINT\_DNS}/exchange/maven/api/v1/organizations/${orgId}/maven</exchange.url>

    The `repositoryId` must match the one you configured for Maven in the `settings.xml` file.

4.  Package the custom policy.

    Follow the same process as documented for the cloud version of Anypoint Platform in
    [Packaging a Custom Policy](https://docs.mulesoft.com/mule-gateway/policies-custom-package).

5.  Upload the custom policy.

    Follow the same process as documented for the cloud version of Anypoint Platform in
    [Uploading a Custom Policy to Exchange](https://docs.mulesoft.com/mule-gateway/policies-custom-upload-to-exchange).

    If you receive an error similar to:

    \[ERROR\] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
    (default-deploy) on project
    ${policyName}:
    Failed to retrieve remote metadata ${groupId}:${policyName}:1.0.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata ${orgId}:${policyName}:1.0.0-SNAPSHOT/maven-metadata.xml from/to exchange-server (https://${ANYPOINT\_DNS}/exchange/maven/api/v1/organizations/${orgId}/maven):
    PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to
    find valid certification path to requested target -> \[Help 1\]

    This means the certificate of the platform is not trusted by the local Maven. The solution is to
    trust the certificate in the environment where Maven is running, as shown in the following
    example:

    keytool -printcert -sslserver ${ANYPOINT\_DNS}:443 -rfc > /tmp/anypoint.crt keytool -importcert
    -alias my-company.com -keystore /etc/ssl/certs/java/cacerts -storepass changeit -file
    /tmp/anypoint.crt

    In the previous example, $ANYPOINT\_DNS is set to the DNS for Anypoint Platform PCE. Replace the
    location and password for your JVM’s truststore.

6.  Verify your policy was uploaded by directly visiting
    `https://${ANYPOINT_DNS}/exchange/?type=policy` or
    `https://${ANYPOINT_DNS}/exchange/${orgID}/${artifactId}/`.

    For an API managed by Mule 4 or later, the policy is displayed in the **Apply Policy** dialog.
