Como analisar dependĂȘncias no IDEA usando a Matriz de estrutura de dependĂȘncia e outras ferramentas.
![](https://habrastorage.org/webt/86/he/s2/86hes28crptwprwlpcynpugcklm.png)
Esta tradução continua a série IntelliJ IDEA:
Matriz de dependĂȘncia
Essa funcionalidade estĂĄ disponĂvel apenas no IntelliJ IDEA Ultimate, mas nĂŁo na versĂŁo Community.
IDEA , . , .
, , .
(Dependency Structure Matrix DSM) . -, build . , , «Analyze â Analyze Dependency Matrix...». IDEA Ultimate DSM Analysis.
:
![](https://habrastorage.org/webt/xy/og/us/xyogusjjgql37zijyzf-mwhzmma.png)
, .
![](https://habrastorage.org/webt/hh/h2/dz/hhh2dza-revyxq3x_d50ertvcgc.png)
IDEA , , , .
. â . . , . , . 99 , ... .
, , . , . .
, . , . . , , .
, , .
![](https://habrastorage.org/webt/-e/y4/b7/-ey4b7cqhxkwlzwwkq2dcbrmuzi.png)
, . ( ), IDEA .
![](https://habrastorage.org/webt/o-/_e/i7/o-_ei7pz27gls5k9kl_upu3if3u.png)
, , . , , .
, . , . , .
![](https://habrastorage.org/webt/n4/os/uw/n4osuwdyhhp3bf6hpccymxpjzm8.png)
. , , , . , .
DSM , , . , .
![](https://habrastorage.org/webt/wh/ml/tz/whmltzzvzmq67vmltycslc0ftri.png)
. , , . DSM :
![](https://habrastorage.org/webt/pb/ae/t1/pbaet1giw4bs_nowi14wxdakzrc.png)
, Owner 15 Pet, Pet 5 Owner.
DSM IDEA â , , .
DSM. , Find usages for dependencies. IDEA / , / .
, . service, - vet. :
![](https://habrastorage.org/webt/e8/jy/02/e8jy02kvk12ldid64sfwfcgr5e0.png)
, .
Maven
IntelliJ IDEA Ultimate, Community .
. , , . . , , ( ). , . Maven , . :
mvn dependency:tree -Dverbose -DoutputFile=dependencies.txt
Maven , ( ):
com.vojtechruzicka:spring-boot-actuator-example:jar:1.0.0-SNAPSHOT
+- org.springframework.boot:spring-boot-starter-actuator:jar:2.0.3.RELEASE:compile
| +- org.springframework.boot:spring-boot-starter:jar:2.0.3.RELEASE:compile
| | +- org.springframework.boot:spring-boot:jar:2.0.3.RELEASE:compile
| | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.3.RELEASE:compile
| | +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.3.RELEASE:compile
| | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
| | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
| | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
| | | | \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
| | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
| | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
| | \- org.yaml:snakeyaml:jar:1.19:runtime
, , , graphml tgf.
, , .
: verbose maven 3.x, Maven 2 .
, IDEA Maven. IntelliJ, 2019.1 , .
, pom.xml Shift + Ctrl + Alt + U ( â„ + ⧠+ â + U Mac). â Diagrams â Show Dependencies.
, , . . , Find , Ctrl + F.
![](https://habrastorage.org/webt/u7/su/mp/u7sumpyjvial2odxjmg_c1uu3ao.gif)
, . , , .
â . , .
![](https://habrastorage.org/webt/z1/tq/ig/z1tqigg4jagx_3havl6m-q0avc0.gif)
, , , Shift.
, .
![](https://habrastorage.org/webt/hz/rh/d_/hzrhd_sdfu5an2k96p3bzdrdfig.gif)
IDEA . , , - . , :
![](https://habrastorage.org/webt/pr/sf/pt/prsfpt9yrpowjbtuwciowtiavjk.gif)
JUnit. JUnit 3.8.1 , spring-boot-starter-test.
Maven Helper
, , . Maven Helper Vojtech Krasa. , mvn dependency:tree, .
, IDEA Community Edition IDEA, Maven .
, , pom.xml. Dependency Analyzer, .
![](https://habrastorage.org/webt/vj/ev/aa/vjevaapwskdrjaeg04ishwguy90.png)
( ). , . , .
Gradle
2019.2, IDEA Maven, Gradle. ! , Maven.
build.gradle Shift + Ctrl + Alt + U ( â„ + ⧠+ â + U Mac). â Diagrams â Show Dependencies.
Quando vocĂȘ cria um aplicativo, a estruturação adequada de suas dependĂȘncias Ă© muito importante, pois uma arquitetura com dependĂȘncias difĂceis e confusas pode ser muito difĂcil de manter, estender e modificar. Felizmente, o IDEA pode ajudar com a matriz de dependĂȘncia estrutural, que fornece uma representação grĂĄfica Ăștil de suas dependĂȘncias internas.
AlĂ©m disso, vocĂȘ precisa garantir que suas dependĂȘncias externas tambĂ©m sejam cobertas, o que vocĂȘ pode obter usando o grĂĄfico de dependĂȘncia do seu sistema de gerenciamento de dependĂȘncias, como o Maven.