This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.tindalos.principle</groupId> | |
<artifactId>principle</artifactId> | |
<version>0.25</version> | |
<configuration> | |
<basePackage>org.tindalos.principle</basePackage> | |
<checks> | |
<layering> | |
<layers> | |
<param>infrastructure</param> | |
<param>app</param> | |
<param>domain</param> | |
</layers> | |
<violationsThreshold>0</violationsThreshold> | |
</layering> | |
<thirdParty> | |
<barriers> | |
<barrier> | |
<layer>infrastructure</layer> | |
<components>org.apache.maven,org.json,org.yaml,com.google.common.collect,jdepend</components> | |
</barrier> | |
<barrier> | |
<layer>domain</layer> | |
<components>org.apache.commons</components> | |
</barrier> | |
</barriers> | |
<violationsThreshold>0</violationsThreshold> | |
</thirdParty> | |
... | |
</plugin> | |
... | |
</plugins> | |
... | |
</build> |
The new part is the <thirdparty>...</thirdparty>. It says that anything under org.apache.commons can be referenced in the Domain layer and up (app and infrastrucure), and the Infrastructure layer can use anything under the listed package paths: org.apache.maven,org.json,org.yaml,com.google.common.collect,jdepend. Anything else used in Infrastructure, e.g. something under org.mongo, would cause an alert. So would the reference to org.json in Domain, since it's only allowed in Infrastructure.
The visual idea behind it is that your code is a castle with multiple circles of defending walls around it. You let foreign troops leaking into your territory only until certain walls. Different troops can have different privileges, one (org.yaml) can only set up his tent inside the outmost wall (Infrastructure), the other (org.apache.commons) is allowed to enter the inner sanctum (Domain). Usable from version 0.25.
No comments :
Post a Comment