Sample Configuration - Simple
Back to Code By Example
Description
This is an example of a simple configuration. It should be complete enough that you could copy and paste it into your own architecture-rules.xml change a line or two, and be up and running with Architecture Rules in a matter of minutes.
This example provides all of the optional configuration values, such as sources not found, and the cyclic dependency testing.
If you only have one target directory, then be sure to delete the other ones.
Code
<architecture>
<configuration>
<sources no-packages="exception">
<source not-found="ignore">core\target\classes</source>
<source not-found="ignore">web\target\classes</source>
<source not-found="exception">ws\target\classes</source>
</sources>
<cyclicalDependency test="true"></cyclicalDependency>
</configuration>
<rules>
<rule id="dao">
<comment>
dao layer depends on no other layers
</comment>
<packages>
<package>com.company.app.core.dao</package>
<package>com.company.app.core.dao.jdbc</package>
</packages>
<violations>
<violation>com.co.app.core.services</violation>
<violation>com.co.app.web</violation>
<violation>com.co.app.web.spring</violation>
</violations>
</rule>
<rule id="web">
<comment>
presentation layer may not use dao directly
</comment>
<packages>
<package>com.co.app.web</package>
<package>com.co.app.web.spring</package>
<package>com.co.app.web.decorators</package>
</packages>
<violations>
<violation>com.co.app.core.dao</violation>
<violation>com.co.app.core.dao.jdbc</violation>
<violation>com.co.app.core.dao.ldap</violation>
</violations>
</rule>
</rules>
</architecture>