Excluded folder reset whenever Maven project is re-imported

Background: We use the xmlbeans plugin with our Maven build. This plugin has the unfortunate behaviour of creating both a target/generated-sources/xmlbleans and a target/generated-sources/text-xmlbeans folder for every class with duplicate classes in each folder. I'm told these classes vary slightly for testing. I've got plenty of other problems with the terrible integration of XmlBeans with Maven, and I'm stuck with it. So...

The problem: When Make is run it always stops on this module with errors about duplicate classes (since that's exactlty what XmlBeans is creating, duplicate classes). To prevent the errors I open the module settings and remove the "test-xmlbeans" from the "Source Folders" and add it to the "Excluded Folders." This only works until I re-import the Maven project, at which point the excluded folder is forgotten and Make fails again.

To work around this I've opened the Project Settings -> Compiler -> Excludes settings and added the target/generated-sources/text-xmlbeans manually. This seems to be working, but it feels like a hack. I've had to explain this workaround to all of my teammates and they also think this is a hack.

So I have two questions: first, is this expected behaviour when re-importing Maven projects, losing all configuration in the module Source Folders?

Second, if this is expected, is the Compiler -> Excluded setting the best way to exclude these folders?


Please sign in to leave a comment.