What is the difference in maven between dependency and plugin tags in pom xml?

后端 未结 8 547
耶瑟儿~
耶瑟儿~ 2020-11-30 16:35

I\'m new to the maven tool, I have made a project with Spring and Hibernate and they are configured in pom.xml as plugins, but JUnit is tagged under dependency. My questio

8条回答
  •  死守一世寂寞
    2020-11-30 17:12

    Plug-ins are used for adding functionalities to Maven itself (like adding eclipse support or SpringBoot support to Maven etc.). Dependencies are needed by your source code to pass any Maven phase (compile or test for example). In case of JUnit since the test code is basically part of your code base and you call JUnit specific commands inside test suites and those commands are not provided by Java SDK therefore JUnit must be present at the time Maven is in the test phase and this is handled by mentioning JUnit as a dependency in your pom.xml file.

提交回复
热议问题