|
maven dependency management
|
|||
---|---|---|---|
#18+
Не могу понять в чём роль dependency management для разрешения зависимостей. Вот пример с официального сайта: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management Project A: Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34.
Project B: Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management When maven is run on project B, version 1.0 of artifacts a, b, c, and d will be used regardless of the version specified in their pom. a and c both are declared as dependencies of the project so version 1.0 is used due to dependency mediation. Both also have runtime scope since it is directly specified. b is defined in B's parent's dependency management section and since dependency management takes precedence over dependency mediation for transitive dependencies, version 1.0 will be selected should it be referenced in a or c's pom. b will also have compile scope. Finally, since d is specified in B's dependency management section, should d be a dependency (or transitive dependency) of a or c, version 1.0 will be chosen - again because dependency management takes precedence over dependency mediation and also because the current pom's declaration takes precedence over its parent's declaration. The reference information about the dependency management tags is available from the project descriptor reference. непонятно самое главное - разве было бы по другому если бы dependencyManagement отсуствовал в Parent или в Child ? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.06.2019, 16:21 |
|
maven dependency management
|
|||
---|---|---|---|
#18+
questioner, на мелких проектах оно не надо. На крупных - централизирует информацию о версии артифакта. В модулях ты указываешь только группу и артифакт. А версия подтягивается из центра. Это предотрващает зависимости от дробления версий-братьев. Тоесть у тебя в проекте всегда будет одна версия артифакта во всех модулях. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.06.2019, 17:02 |
|
maven dependency management
|
|||
---|---|---|---|
#18+
maytonquestioner, на мелких проектах оно не надо. На крупных - централизирует информацию о версии артифакта. В модулях ты указываешь только группу и артифакт. А версия подтягивается из центра. Это предотрващает зависимости от дробления версий-братьев. Тоесть у тебя в проекте всегда будет одна версия артифакта во всех модулях. Это ясно, а по сути моего вопроса есть что-то? там про приоритеты речь ... |
|||
:
Нравится:
Не нравится:
|
|||
11.06.2019, 18:46 |
|
|
start [/forum/topic.php?fid=59&fpage=26&tid=2121248]: |
0ms |
get settings: |
10ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
73ms |
get topic data: |
10ms |
get forum data: |
2ms |
get page messages: |
43ms |
get tp. blocked users: |
2ms |
others: | 15ms |
total: | 178ms |
0 / 0 |