What I want to do is put various <sql>...</sql>
blocks in a Shared.xml file and then have more specific files include them.
Something like this:
mybatis-config.xml
<configuration>
<mappers>
<mapper resource="Shared.xml"/>
<mapper resource="Custom1.xml"/>
<mapper resource="Custom2.xml"/>
<mapper resource="Custom3.xml"/>
</mappers>
</configuration>
Shared.xml
<mapper namespace="com.company.SharedMapper">
<sql id="someSQL">
SELECT 1;
</sql>
</mapper>
Custom1.xml
<mapper namespace="com.company.CustomMapper1">
<select id="getSomeData" resultMap="CustomResultMap">
<include refid="someSQL"/>
</select>
</mapper>
Obviously this is a very simplified version of what I want but hopefully it's enough to describe what I am going for.
TIA
Yes, you can, that is supported. In case the dependant xml is read first MyBatis will retry again when the rest of xml pieces are loaded.