The dependency plugin works perfectly when doing policy resolution. However, despite trying and trying, I have not been able to get flow resolution to work.
I have been following the steps and using samples from:
https://github.com/apigee/proxy-dependency-maven-plugin
Are there any gotchas to defining flowfrag files or something else that might be missing from the available doc?
I have a common_ping_request_flow_steps.flowfrag file in my proxies directory with the following contents:
<Step> <Name>JavaScript.SetPingVariables</Name> </Step> <Step> <Name>RaiseFault.SetPingResponse</Name> </Step>
And a monitoring.xml proxy endpoint definition on the same directory as follows:
<ProxyEndpoint name="monitoring"> <PreFlow> <Request> <Step> <Name>JavaScript.GetClientIp</Name> </Step> </Request> </PreFlow> <Flows> <Flow name="Ping"> <Condition> (proxy.pathsuffix MatchesPath "/ping") and (request.verb = "GET") </Condition> <Request> #common_ping_request_flow_steps# </Request> </Flow> </Flows> <RouteRule name="default"> <TargetEndpoint>default</TargetEndpoint> </RouteRule> <HTTPProxyConnection> <BasePath>/atytarget/probes</BasePath> <VirtualHost>https_vhost</VirtualHost> </HTTPProxyConnection> </ProxyEndpoint>
The config in my pom for the plugin is:
<!-- dependency resolution --> <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>../CommonProxy</proxyRef> </proxyRefs> </configuration> </execution> </executions> </plugin>
I have a Common proxy where I keep the policies used and those get successfully pulled. However, no flowfragment replacement happens.
Solved! Go to Solution.
Flow frags have a couple of requirements to my knowledge.
They must live in the proxies directory
and
when referencing them in your code you use only the name minus the prefix
apiproxy
-proxies
--flow-fragment-base-filname.flowfrag
.
.
.
<Flows> <PreFlow name="PreFlow"> <Request/> <Response> #flow-fragment-base-filename# </Response> </PreFlow>
#flow-fragment-base-filename#
without the.flowfrag
extension
I found my issue. Another plugin in my pom was moving the updated files and leaving the unmodified ones in place of them. I have corrected this and can see the substitution works as expected.
@srichardson I really appreciate the time you took to confirm usage it helped troubleshoot the problem.
Can you post an example of how your currently setting up the flow frags?
Certainly. I have just updated the question.
can you add your pom configuration for the plugin?
Of course, done. Thanks for looking into this, it is driving me mad.
Flow frags have a couple of requirements to my knowledge.
They must live in the proxies directory
and
when referencing them in your code you use only the name minus the prefix
apiproxy
-proxies
--flow-fragment-base-filname.flowfrag
.
.
.
<Flows> <PreFlow name="PreFlow"> <Request/> <Response> #flow-fragment-base-filename# </Response> </PreFlow>
#flow-fragment-base-filename#
without the.flowfrag
extension
Have you tried using the newer version
2.1.0 instead of 2.0.0?
Everything else in you examples look fine
I just tried and unfortunately still not working. I am proceeding to reproduce and an even simpler proxy configuration (although it can't get much simpler).
If you have a working dummy project you can share do please send it across.
Thanks again for the comments.
I found my issue. Another plugin in my pom was moving the updated files and leaving the unmodified ones in place of them. I have corrected this and can see the substitution works as expected.
@srichardson I really appreciate the time you took to confirm usage it helped troubleshoot the problem.
Thank you @gonzalo.silva.cruz for asking this question. We had run into the exact same issue & this answer helped us.
We were doing copy resources in parent-pom in phase "package" which actually overrides the proxy dependency changes. We moved them into "prepare-package" phase & issue is resolved.
<plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <encoding>UTF-8</encoding> <echo message="basedir parent : ${basedir}"/> <outputDirectory>${basedir}/target/apiproxy</outputDirectory> <resources> <resource> <directory>apiproxy</directory> </resource> </resources> </configuration> </execution> </executions> </plugin>