How can I use proxy-dependency-maven-plugin to add code fragments to my API proxy?

Not applicable

I am developing several proxies for an API and I will want to use maven plugin to insert code fragments into my code for the common parts. I am using it for the default fault rule that is the same for all to avoid duplicating code but I cannot make it work. This is the code I am using: <DefaultFaultRule name="Store Locator - Default Always Runs">

#FragmentCode#

</DefaultFaultRule> Then I have a folder in the project with this FragmentCode.flowfrag file I also have policy files to be copied (and they are copied), but this FragmentCode is not inserted when uploaded into Apigee using maven deployment script. I have added the plugin to the pom.xml file too.

Can anyone throw some light on it?

0 2 1,328
2 REPLIES 2

Not applicable

Can you share your shared-pom.xml (sanitized of course). Typically this is due to not referencing the correct directory in the plugin (shared-pom.xml). You should verify your directories are reachable from the directory where you are executing from, not relative to where shared-pom.xml lives.

Typically it should look like this:

            <plugin>
                <groupId>io.apigee.build-tools.enterprise4g</groupId>
                <artifactId>proxy-dependency-maven-plugin</artifactId>
                <version>2.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                        <configuration>
                            <proxySrcDir>.</proxySrcDir>
                            <proxyDestDir>./target</proxyDestDir>
                            <proxyRefs>
                                <proxyRef>../CommonCode</proxyRef>
                                <proxyRef>../OtherCode</proxyRef>
                                <proxyRef>../MoreCode</proxyRef>
                            </proxyRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Thank you for your response Dallen.

I have checked the path and it is OK as the files under policies folder are copied when deployed.

<plugin>
    <groupId>io.apigee.build-tools.enterprise4g</groupId>
    <artifactId>proxy-dependency-maven-plugin</artifactId>
    <version>2.0.0</version>
    <executions>
        <execution>
	    <goals>
	        <goal>resolve</goal>
	    </goals>
	    <configuration>
	        <proxySrcDir>.</proxySrcDir>
	        <proxyDestDir>./target</proxyDestDir>
	        <proxyRefs>
	            <proxyRef>./common-api</proxyRef>
	        </proxyRefs>
	    </configuration>
        </execution>
    </executions>
</plugin>