{"id":5988,"date":"2018-03-18T09:25:29","date_gmt":"2018-03-18T09:25:29","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=5988"},"modified":"2018-03-18T09:25:29","modified_gmt":"2018-03-18T09:25:29","slug":"cxf-codegen-plugin-not-generating-proxies-everytime","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/cxf-codegen-plugin-not-generating-proxies-everytime\/","title":{"rendered":"cxf-codegen-plugin not generating proxies everytime"},"content":{"rendered":"<p>In case this helps others out&#8230;<\/p>\n<p>I am working on a Java project at the moment using Maven to build the code and run tests etc. I&#8217;m also using the cxf-codegen-plugin plugin (as below) to generate some proxies for a soap\/wsdl file I have.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;plugin&gt;\r\n   &lt;groupId&gt;org.apache.cxf&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;cxf-codegen-plugin&lt;\/artifactId&gt;\r\n   &lt;version&gt;3.2.2&lt;\/version&gt;\r\n   &lt;executions&gt;\r\n      &lt;execution&gt;\r\n         &lt;id&gt;generate-sources&lt;\/id&gt;\r\n         &lt;phase&gt;generate-sources&lt;\/phase&gt;\r\n         &lt;configuration&gt;\r\n         &lt;wsdlOptions&gt;\r\n            &lt;wsdlOption&gt;\r\n               &lt;wsdl&gt;${project.basedir}\/src\/main\/resources\/wsdl\/Svc.wsdl&lt;\/wsdl&gt;\r\n               &lt;wsdlLocation&gt;classpath:wsdl\/Svc.wsdl&lt;\/wsdlLocation&gt;\r\n               &lt;extraargs&gt;\r\n                  &lt;extraarg&gt;-verbose&lt;\/extraarg&gt;\r\n                  &lt;extraarg&gt;-client&lt;\/extraarg&gt;\r\n                  &lt;extraarg&gt;-p&lt;\/extraarg&gt;\r\n                  &lt;extraarg&gt;com.putridparrot.soap&lt;\/extraarg&gt;\r\n               &lt;\/extraargs&gt;\r\n            &lt;\/wsdlOption&gt;\r\n         &lt;\/wsdlOptions&gt;\r\n         &lt;\/configuration&gt;\r\n         &lt;goals&gt;\r\n            &lt;goal&gt;wsdl2java&lt;\/goal&gt;\r\n         &lt;\/goals&gt;\r\n      &lt;\/execution&gt;\r\n   &lt;\/executions&gt;\r\n&lt;\/plugin&gt;\r\n<\/pre>\n<p>I found that when I tried to either use <em>mvn generate-sources<\/em> <em>mvn install<\/em> the generated source folder was deleted and recreated, however the proxies folder had no proxy code\/files (i.e. the files were deleted and not regenerated). <\/p>\n<p>If I ran <em>mvn clean install<\/em> the proxy code would re-appear, but subsequent calls to generate-source of install would again delete the proxy code\/files.<\/p>\n<p>To cut a long story short it appeared that another plugin was clearing out the generated-sources folder but the <em>cxf-codegen-plugin<\/em> plugin would not regenerate it&#8217;s proxy code\/files because of another file which the plugin created in the cxf-codegen-plugin-markers folder.<\/p>\n<p>Within this folder is a file with a UUID style name. This was being plugin used by the plugin to check whether it needed to regenerate it&#8217;s proxy code\/files (it doesn&#8217;t check if the files exist or simply regenerate them each time it&#8217;s run).<\/p>\n<p><em>You can recreate the problem easily by running mvn generate-sources to create the proxies, then delete the generated-sources folder and run mvn generate-sources again. No proxy files are created. Now delete the marker file and the proxies will get regenerated.<\/em><\/p>\n<p>Deleting this folder (or just the file within it) will fix the problem.<\/p>\n<p>To stop this happening again you can either ensure the folder or file are deleted when the generate-sources folder is deleted or even simpler just write your proxies to another folder, so this would now get deleted by the other plugins.<\/p>\n<p>i.e.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;configuration&gt;\r\n   &lt;sourceRoot&gt;${project.build.directory}\/cxf&lt;\/sourceRoot&gt;\r\n   &lt;!-- other config --&gt;\r\n&lt;\/configuration&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In case this helps others out&#8230; I am working on a Java project at the moment using Maven to build the code and run tests etc. I&#8217;m also using the cxf-codegen-plugin plugin (as below) to generate some proxies for a soap\/wsdl file I have. &lt;plugin&gt; &lt;groupId&gt;org.apache.cxf&lt;\/groupId&gt; &lt;artifactId&gt;cxf-codegen-plugin&lt;\/artifactId&gt; &lt;version&gt;3.2.2&lt;\/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;generate-sources&lt;\/id&gt; &lt;phase&gt;generate-sources&lt;\/phase&gt; &lt;configuration&gt; &lt;wsdlOptions&gt; &lt;wsdlOption&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[209,160],"tags":[],"class_list":["post-5988","post","type-post","status-publish","format-standard","hentry","category-cxf-codegen-plugin","category-maven"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=5988"}],"version-history":[{"count":4,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5988\/revisions"}],"predecessor-version":[{"id":6003,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5988\/revisions\/6003"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=5988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=5988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=5988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}