Loading

412 Precondition Failed error on setting v3 in the Maven Repository url

Udgivelsesdato: Sep 19, 2024
Løsning

SYMPTOM

When deploying an application to Exchange on setting v3 in the Maven Repository url an error is faced:

Url is passed as:

<repository>
<id>Repository</id>
<name>Corporate Repository</name>
<url>https://maven.anypoint.mulesoft.com/api/v3/organizations/YOUR-ORGANISATION-ID/maven</url>
<layout>default</layout>
</repository>


The below error is faced:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project cloudhub-deploy: 
Failed to deploy artifacts: Could not transfer artifact Your-Organization-ID:cloudhub-deploy:pom:1.0.2 from/to Repository 
(https://maven.anypoint.mulesoft.com/api/v3/organizations/Your-Organization-ID/maven): transfer failed for 
https://maven.anypoint.mulesoft.com/api/v3/organizations/Your-Organization-ID/maven/Your-Organization-ID/cloudhub-deploy/1.0.2/cloudhub-deploy-1.0.2.pom, 
status: 412 Precondition Failed -> [Help 1]

 

CAUSE

If the build fails during the deploy stage with a status code of 412 (Precondition Failed), then <goal>exchange-pre-deploy</goal> was not executed.

SOLUTION

There are 2 possibles solutions:

1) To fix this error, do ensure that goal is set inside the executions section of the plugin.
 

<build>
    <plugins>
        <plugin>
            <groupId>org.mule.tools.maven</groupId>
            <artifactId>exchange-mule-maven-plugin</artifactId>
            <version>0.0.13</version>
            <executions>
                <execution>
                    <id>validate</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>exchange-pre-deploy</goal>
                    </goals>
                </execution>
                <execution>
                    <id>deploy</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>exchange-deploy</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

2) If the first option does not work, remove the exchange-mule-maven-plugin ( if it was added), then check if you have defined the maven-deploy-plugin in the plugins section, and remove that plugin.


Refer to the help link - Publish a Custom Asset
 

Vidensartikelnummer

001120384

 
Indlæser
Salesforce Help | Article