Maven plugin developer doumentation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven plugin developer doumentation

Christopher
Hi,

I develop some Maven plugins, and am struggling trying to find
documentation on which dependencies are provided by a particular version of
Maven, and when I should use a newer compatible version as the dependency
in my plugin.

For example, I have a plugin which declares 3.2.5 as a prerequisite and has
the following dependencies:
  maven-core (3.2.5, provided)
  maven-plugin-api (3.2.5, provided)
  maven-plugin-annotations (3.5, provided)
  plexus-utils (3.0.24, provided)

However, I don't actually know which versions of these plugins are provided
by which Maven versions, and whether or not I could use this plugin with an
earlier version of Maven. Perhaps I could set the prerequisite to 3.0.5 and
it would work fine?

Ideally, every version of Maven would release with a guide for plugin
developers, to let developers know which versions of the dependencies they
should use, but I can't find anything like that. Is there a useful guide
somewhere?

A related problem that could be covered by a developer guide: which maven
library code is executed during plugin execution, and which are executed
during plugin compilation? (In other words, when is it safe to user a newer
version of a particular dependency, without breaking that plugin's
compatibility with a particular version of Maven?) Perhaps this really
boils down to: "How stable are the APIs for these Maven libraries used for
Maven plugins?"

Hopefully, there's already a useful guide out there, or maybe just a few
simple guidelines which can be shared with me. Otherwise, I fear this might
be another "dependency hell" issue.


Thanks for any guidance you can provide for managing plugin dependencies,

Christopher
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin developer doumentation

Anders Hammar
What you should typically do is declare dependency to the lowest version of
Maven that you want to support support. So for our core Apache Maven
plugins we declare dependency to version 3.0 of the (core) Maven
dependencies, which is because we want the plugins to support v3.0+ of
Maven. So we build the plugin towards the v3.0 libs but it should work with
3.5.0 for example as it is intended to be backwards compatible.

The second part of this is to figure out what dependencies that are related
to (core) Maven. That would be those libraries that are in the groupId
"org.apache.maven". Those are the ones that should have version "3.0", for
example, according ot the thinking described above. Anything else could be
what ever you see fit. In your list, for example, that would be
"maven-plugin-annotations"
and "plexus-utils". Typically you would select the latest version available.

/Anders

On Tue, Oct 24, 2017 at 2:06 AM, Christopher <[hidden email]> wrote:

> Hi,
>
> I develop some Maven plugins, and am struggling trying to find
> documentation on which dependencies are provided by a particular version of
> Maven, and when I should use a newer compatible version as the dependency
> in my plugin.
>
> For example, I have a plugin which declares 3.2.5 as a prerequisite and has
> the following dependencies:
>   maven-core (3.2.5, provided)
>   maven-plugin-api (3.2.5, provided)
>   maven-plugin-annotations (3.5, provided)
>   plexus-utils (3.0.24, provided)
>
> However, I don't actually know which versions of these plugins are provided
> by which Maven versions, and whether or not I could use this plugin with an
> earlier version of Maven. Perhaps I could set the prerequisite to 3.0.5 and
> it would work fine?
>
> Ideally, every version of Maven would release with a guide for plugin
> developers, to let developers know which versions of the dependencies they
> should use, but I can't find anything like that. Is there a useful guide
> somewhere?
>
> A related problem that could be covered by a developer guide: which maven
> library code is executed during plugin execution, and which are executed
> during plugin compilation? (In other words, when is it safe to user a newer
> version of a particular dependency, without breaking that plugin's
> compatibility with a particular version of Maven?) Perhaps this really
> boils down to: "How stable are the APIs for these Maven libraries used for
> Maven plugins?"
>
> Hopefully, there's already a useful guide out there, or maybe just a few
> simple guidelines which can be shared with me. Otherwise, I fear this might
> be another "dependency hell" issue.
>
>
> Thanks for any guidance you can provide for managing plugin dependencies,
>
> Christopher
>