Simplify logic for using <directory>

Tested with forgerock-doc-maven-plugin-test