3

I'm trying to find out where the dependencies are coming from for a particular plugin goal. I know the dependencies exist because Maven downloaded them when I ran the goal for the first time. And they're not (directly) dependencies of my project, because I ran mvn clean install first, and these dependencies weren't downloaded then.

In this specific case, I'm trying to figure out what the dependencies are when I run mvn sonar:sonar, but I expect the answer will be general purpose. For instance, even though I've built this project a number of times, when I ran that goal Maven downloaded a bunch of new jars like maven-antrun-plugin.

Here are things I've tried:

  • mvn dependency:tree shows the dependencies for the project, but not for the plugin goal (it doesn't include anything related to SonarQube in the list).
  • mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom -Dverbose=true also doesn't include anything related to SonarQube.
  • mvn -X sonar:sonar prints out what looks like a dependency graph, but it's missing the jars that Maven downloaded the first time I ran the sonar:sonar goal.
  • mvn -X dependency:resolve-plugins seems to be meant to download the dependencies of plugins, but does not capture the sonar:sonar dependencies. If I clear out my Maven cache, run mvn dependency:resolve-plugins, and then run mvn sonar:sonar, Maven has to download jars.
Tom Panning
  • 4,613
  • 2
  • 26
  • 47
  • There two thing. Sonar plugin itself loads separately something down from sonar server... and the real maven plugin... – khmarbaise Dec 30 '20 at 22:01
  • Is [this](https://stackoverflow.com/a/7079876/294657) what you're looking for? – kaqqao Dec 30 '20 at 22:11
  • Another option is to find the POM of the plugin project. Either on the internet or by using IDE navigation features (e.g. Ctrl + Clicking on the plugin declaration in your project's POM). Don't know if there is a way just for an invidigual goal, though. – Reto Höhener Dec 30 '20 at 22:51
  • @kaqqao I forgot to include that in the "things I've tried". I've added it now. – Tom Panning Dec 31 '20 at 03:24
  • @RetoHöhener I tried doing that using mvnrepository.com, but it became clear that trying to trace the tree manually is very time consuming. – Tom Panning Dec 31 '20 at 03:27
  • You probably have to look at the sources of the sonar plugin. May I ask why are trying to find these dependencies? Are you trying to build some kind of offline system? Or are you looking for a specific dependency? – J Fabian Meier Dec 31 '20 at 08:17

2 Answers2

2

Use your IDE to navigate to the POM of the plugin project and then look at the dependency tree.

Or do this manually by copying the plugin POM to your file system and running mvn dependency:tree.

enter image description here

Reto Höhener
  • 5,419
  • 4
  • 39
  • 79
0

The dependencies downloaded by maven are generally stored locally on the pc at the address C:\Users\yourUser/.m2 this regardless of your projects and so that you do not have to reload dependencies that you are already using in other projects.

I hope I have understood your question and that my answer is useful to you, greetings.

  • I'm looking for how to determine what all the dependencies of a plugin are, similar to what `mvn dependency:tree` does for a project – Tom Panning Dec 31 '20 at 03:19
  • This is just for Windows and there's something missing. More general and complete it's `${user.home}/.m2/repository` as default and can be re-defined in [`settings.xml`](http://maven.apache.org/settings.html). – Gerold Broser Dec 31 '20 at 20:01