Maven - generate-sources

We are using mvn to generate web service clients.  Per the CXF instructions, we designate the sourceRoot as ${basedir}/target/generated/src/main/java.  The only problem with this is that you then have to manually unset the target directory as ignored and set the java directory as a src directory.  This gets to be tedious.  Is there something else that we should be doing or do I need to file a request to honor the sourceRoot?

7 comments
Comment actions Permalink

Thanks for your help, I've reproduced the problem.

The Maven Embedder fails to retrieve runtime sources information for this plugin, I haven't found why yet.
Anyway, I'm planning to upgrade bundled version of embedder and, hopefully, the problem will be solved.

For now you can use the workaround I've describled - put your generated files under 'target/generates-sources/somedir/'.

Thanks,
Anton Makeev

1
Comment actions Permalink

Is there a plan to fix this?

1
Comment actions Permalink

Hi, Norris,

You can use 'Update Folders' action on the Maven Project tool window. It runs a specified goal (Settings->Importing->Update folders goal) and sets IDEA's folders according to the configuration in your pom files.

Thanks,
Anton Makeev

0
Comment actions Permalink

I am using 10624.  Maven | Importing has all 3 checkboxes checked and "Phase to be used to update folders" doesn't work with generate-sources or process-test-resources.

I deleted all of the project files and opened the parent pom.xml.  I ran the package goal for the parent.  I saw the web service client generate the sources.  The entire target directory was still ignored. I tried "Update Folders for all Projects" from the Maven Projects tab.  No change.

0
Comment actions Permalink

Hi, Norris,

I've rechecked 'update folders' feature and coudn't reproduce any problem.
What plugin do you use for code generation? I'll check if it provides necessary runtime information to configure source folders.
I believe that it doesn't and as a workaround you can put your generated sources in 'target/generated-sources/<plugin_name>' dir. This is a standard convention for generated code and IDEA automatically attaches the sources under this dir.

Thanks,
Anton Makeev

0
Comment actions Permalink

Attached is an example pom.  We use the CXF plugin to generate the sources.  You can point it to a wsdl URL or to a file that contains a wsdl.

Thanks for your help on this.  CXF generates the best WS clients and we use it for all of our service clients.



Attachment(s):
pom.xml
0
Comment actions Permalink

Could you also attach a sample wsdl file? I'm afraid I can't write it by myself )

0

Please sign in to leave a comment.