Search code examples
eclipsemybatis-generator

How to put SqlMap files into src/main/resources with MyBatis Generator Eclipse Plugin?


Is it possible to configure the MyBatis Generator Eclipse plugin to generate the SqlMap files in the src/main/resources directory?

When I use a path for targetProject, I get an error. When I use only the project, the SqlMap XML files are created in src/main/java (and I have to use maven to copy them to src/main/resources.

<sqlMapGenerator targetPackage="xml.fabric" targetProject="domain/src/main/resources" >
</sqlMapGenerator>

This results in the error:

Cannot find source folder domain/src/main/resources

src/main/resources exists.


Solution

  • We discussed this on the MyBatis user mailing list.

    The reason the folder couldn't be found was that it was not setup as a source folder in the eclipse project. The MyBatis generator eclipse plugin will only write into eclipse source folders.

    So the targetProject above was configured correctly, but the eclipse project itself needed to be updated to make "src/main/resources" a source folder.