How to override the auto generated mule-artifact.json with mule extension

410 Views Asked by At

Is it possible to override the auto-generated mule-artifact.json when creating a custom mule extension?

2

There are 2 best solutions below

0
William On BEST ANSWER

A work around for overriding the auto-generated mule-artifact.jsonis to add maven-resources-plugin to your pom and run it after the mule-extensions-maven-plugin creates the file. Here is what I used:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-custom-artifact</id>
            <phase>process-classes</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${basedir}/target</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/resources/META-INF/mule-artifact</directory>
                        <targetPath>classes/META-INF/mule-artifact</targetPath>
                    </resource>
                </resources>
                <overwrite>true</overwrite>
            </configuration>
        </execution>
    </executions>
</plugin>
13
Harshank Bansal On

Yes it can be overridden, you need to place your custom mule-artifact.json under META-INF/mule-artifact/mule-artifact.json inside your project's src/main/resources.