미운 오리 새끼의 우아한 개발자되기

[Maven] Plugin vs. Dependencies 본문

IT 이모저모

[Maven] Plugin vs. Dependencies

Serina_Heo 2021. 1. 23. 22:45

I've been working on Maven Project these days and I was wondering what's the difference between Plugings and Dependencies. I guess you guys might had the same questions about it when you see POM which means Project Obeject Model. 

First, what is POM file? and what does this file do? POM is defined like below by Apache foundation website.

POM is an XML(Extensible Markup Language) file that countails information about the project and configuration details used by Maven to build the project. 

>>Check the link below to see more description about POM.

https://maven.apache.org/guides/introduction/introduction-to-the-pom.html

 

Maven – Introduction to the POM

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Examples for t

maven.apache.org

 

So in this POM file there are lots of dependencies and plugins. 

I've searched the diffrence between them and I found one answer in Stack over flow.

https://stackoverflow.com/questions/11881663/what-is-the-difference-in-maven-between-dependency-and-plugin-tags-in-pom-xml

He/She said...

Both are Jar files. But most of work is done using plugins (You could see Maven compiler plugin) and dependency is just a Jar file which will be added to the classpath while executing the tastks. 

Plugin is a Jar file which executes the task, and dependency is a Jar which provides the class files to execute the task.

 

Hope this could be the answer what you've been looking for!