How to scan maven plugin dependency?

In my project I attached commons-lang3 to plugin and commons-io to project:


Within my custom plugin (within my mojo), I can find commons-io

private MavenProject project;
project.getDependecies(); // [{groupId=commons-io, artifactId=commons-io...

How to find commons-lang3?


Using the Maven API, from the MavenProject you can get the Build instance and from it then the list of configured plugins, from each Plugin object you can then have its dependencies as following:

private PluginDescriptor pluginDescriptor;

List<Plugin> plugins = project.getBuild().getPlugins();
for (Plugin p : plugins) {
    if (p.getId().equals(pluginDescriptor.getId())) {
       List<Dependency> pluginDependencies = p.getDependencies();
       // your logic here

If you really want to cover every case, you can also scan the plugins configured in the currently active profiles as following:

List<Profile> profiles = project.getActiveProfiles();
for (Profile p : profiles) {
   // from personal experience, don't forget this check!
   if (p.getBuild() != null) {

Hope that helps.

As commons-lang3 is declared as a dependency only for a specific plugin, it is not available during compilation. You have to explicitly define commons-lang3 as a dependency (if its not getting included as a transitive dependency) similar to how you have defined commons-io.

Need Your Help

Get a list of available domains (NT4 and Active Directory)

c# active-directory nt4

Does anyone know (in c#) a way of getting the available NT4 domains (a bit like the WinXP login box dropdown)?

Getting Image size of JPEG from its binary

file binary jpeg

I have a lot of jpeg files with varying image size. For instance, here is the first 640 bytes as given by hexdump of an image of size 256*384(pixels):