Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven terms -- dependency and plugin, repository vs. pluginRepository

Tags:

java

maven

I've been working with Maven for days but still get confused about some of the terms:

First question is what is the difference between repository and pluginRepository? If there is functional difference so shall I put one url for both?

Second question is what is the difference between dependency and plugin? Maybe they are totally different item to compare because plugin can include dependencies, but to me plugins look like some kind of dependencies in a build? Just like "This build depends on these plugins, and one of this plugin depends on that dependencies", I always think dependencies are kind of library jars, and plugins are library jars or depending projects in jars...

Sorry if the question is kind of dumb, but I am really confused. Please give a hint, thanks.

like image 699
Dreamer Avatar asked Aug 20 '12 20:08

Dreamer


People also ask

What is the difference between plugin and dependency in Maven?

A plugin is an extension to Maven, something used to produce your artifact (maven-jar-plugin for an example, is used to, you guess it, make a jar out of your compiled classes and resources). A dependency is a library that is needed by the application you are building, at compile and/or test and/or runtime time.

What are three types of Maven repository?

There are 3 types of maven repository: Local Repository. Central Repository. Remote Repository.

What is the difference between plugin and pluginManagement tags?

pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.

What is a Maven plugin repository?

In Maven terminology, a repository is a directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.


1 Answers

Back in Maven1.0, plugins and normal artifacts were in different repositories (as far as I know). In Maven2+ they are stored together in a repository. But there are many different repositories out there from many different companies and projects so you have to pick the repositories you need.

A plugin is a tool you use at the execution of your maven build. For example, the compiler plugin compiles your Java code into Bytecode. A normal dependency are artifacts you use in your application like libraries.

Both plugins and artifacts can have transitive dependencies. That means they have dependencies themselves.

like image 64
keiki Avatar answered Sep 20 '22 16:09

keiki