0

When I was building a CI/CD with github actions, I ran into the following problems.

[INFO]   ------------------------------------------------------------
[INFO]   Publication status: error
[INFO]   ------------------------------------------------------------
[INFO]     Steps: 
[INFO]     - Description: Publishing asset
[INFO]     - Status: error
[INFO]     - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.]
[INFO]     .........................................
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

The following is my maven configuration

<plugin>
    <groupId>org.mule.tools.maven</groupId>
    <artifactId>mule-maven-plugin</artifactId>
    <version>${mule.maven.plugin.version}</version>
    <extensions>true</extensions>
    <configuration>
        <sharedLibraries>
            <sharedLibrary>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>mssql-jdbc</artifactId>
            </sharedLibrary>
        </sharedLibraries>
        <cloudhub2Deployment>
            <uri>https://anypoint.mulesoft.com</uri>
            <provider>MC</provider>
            <environment>DEV</environment>
            <target>****</target>
            <muleVersion>4.4.0</muleVersion>
            <server>anypoint-exchange-v3</server>
            <businessGroup>AAAA</businessGroup>
            <businessGroupId>*********</businessGroupId>
            <applicationName>test-app2023</applicationName>
            <replicas>1</replicas>
            <vCores>0.1</vCores>
            <deploymentSettings>
                <http>
                    <inbound>
                        <publicUrl>tes-app2023t.anypoint.com</publicUrl>
                    </inbound>
                </http>
                <lastMileSecurity>false</lastMileSecurity>
                <forwardSslSession>false</forwardSslSession>
                <generateDefaultPublicUrl>true</generateDefaultPublicUrl>
            </deploymentSettings>
            <server>****</server>
            <properties>
                
                <anypoint.platform.base_uri>https://anypoint.mulesoft.com/</anypoint.platform.base_uri>
                <anypoint.platform.client_id>****</anypoint.platform.client_id>
                <anypoint.platform.client_secret>****</anypoint.platform.client_secret>
                <anypoint.platform.analytics_base_uri>https://analytics-ingest.anypoint.mulesoft.com</anypoint.platform.analytics_base_uri>
                
            </properties>
        </cloudhub2Deployment>
        <classifier>mule-application</classifier>
    </configuration>
</plugin>

How should I properly set my exchange asset to rest-api instead of app? I checked mulesoft's documentation and couldn't find a way to define...

Lex
  • 59
  • 7

2 Answers2

2

The Mule Maven Plugin shared is configured for a Mule application. The asset type is set by the <classifier> element. Since this is a Mule application it is a correct type. In Anypoint Exchange a rest-api asset type identify an API description composed of RAML or OAS files. The Mule Maven Plugin is not compatible with that kind of assets, which makes sense because they are not built with Maven. If the Mule application implements a REST API, it is still a Mule application asset.

On the other hand if your asset is really RAML or OAS files you should use the Anypoint CLI instead to publish it to Anypoint Exchange. Read https://docs.mulesoft.com/exchange/to-create-an-asset for the different ways to create different types of assets.

aled
  • 21,330
  • 3
  • 27
  • 34
  • Hi thank you for your answer, as you said I am making a mule app, I need to link this mule app with a raml file, so I need to publish the app to exchange first, then deploy to cloudhub2.0. maven does not support this, right? I'll try to use anypoint cli. – Lex Jan 25 '23 at 02:03
  • The Mule Maven Plugin does support both publishing to Exchange and publishing to CloudHub 2.0 (https://docs.mulesoft.com/mule-runtime/4.4/deploy-to-cloudhub-2). I'm not sure what do you mean by linking to the application to a RAML file. If you explain that part it would be helpful. – aled Jan 25 '23 at 02:32
0

I solved this problem myself. The problem was caused by the duplication of the asset name of the API (raml) published from Design center and the asset name of the API (app) published from Maven. I changed the artifactId in the pom.xml and solved the problem.

<groupId>****</groupId>
<artifactId>{asset name}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
Lex
  • 59
  • 7