Search code examples
mulemule4mule-sdk

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


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


Solution

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