Home > Blockchain >  How do I specify the type of asset when I publish asset to mulesoft's exchange?
How do I specify the type of asset when I publish asset to mulesoft's exchange?

Time:01-26

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...

CodePudding user response:

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.

CodePudding user response:

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>
  • Related