Here is how to analyze the spring core jar for example. Even though the below uses plain command line, an eclipse and maven plugins are available at the moment so you might want to check those out. Specially you should build ddf files to enforce your architectural layers and make sure the build fails if it is violated.
This file contains 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
# Installing | |
$ sudo mkdir /opt/tools | |
$ sudo chown dev /opt/tools | |
$ mv ~/Downloads/Classycle1.4.1 /opt/tools | |
# Running the "Analyser" | |
$ cd /opt/tools/Classycle1.4.1 | |
$ java -jar classycle.jar -mergeInnerClasses -xmlFile=spring-core-classycle.xml /home/dev/.m2/repository/org/springframework/spring-core/3.2.4.RELEASE/spring-core-3.2.4.RELEASE.jar | |
# Running the "Dependency Checker" | |
$ java -cp classycle.jar classycle.dependency.DependencyChecker -dependencies=@spring-core.ddf -mergeInnerClasses /home/dev/.m2/repository/org/springframework/spring-core/3.2.4.RELEASE/spring-core-3.2.4.RELEASE.jar | |
# Here is the sample dependency definition (ddf) file. Note that we analyze the spring-core jar file classes and packages assuming core and util packages will not depend on each other but actually they do (probably by design). | |
$ vi spring-core.ddf | |
show allResults | |
{package} = org.springframework | |
[core] = ${package}.core.* | |
[util] = ${package}.util.* | |
check sets [core] [util] | |
check [util] independentOf [core] | |
check [core] independentOf [util] | |
check absenceOfPackageCycles > 1 in ${package}.* | |
layer core = [core] | |
layer util = [util] | |
check layeringOf core util |
No comments:
Post a Comment