3

There executes a particular Maven plugin and I struggle to find out where it comes from to either remove or replace it as its compile dependency link is broken. I am talking about org.reflections:reflections-maven:0.9.8 that depends on org.jfrog.jade.plugins.common:jade-plugin-common:1.3.8 which Maven is not able to download from the central repository as the link redirects to OpenMind location and results in 404 (link).

Instead of including such JAR in the project structure, I would rather figure out where is reflections-maven plugin defined as this plugin is discontinued (GitHub) but somehow is executed during the build (mvn clean install).

[INFO] --- reflections-maven:0.9.5:reflections (default) @ my-module ---
[INFO] Reflections took 240 ms to scan 1 urls, producing 35 keys and 128 values 
[INFO] Reflections successfully saved in C:\Dev\my-project\my-parent\my-module\target\classes\META-INF\reflections\my-module-reflections.xml using XmlSerializer

I haven't found where is reflections-maven defined in any of the multi-module project structure or used. Note I use Maven 3.3.9. My attempts:

  • Skimming through all plugins and dependencies pom.xml of the failing module and all its parents (the module depends on other modules, however, they were all built successfully before the failing one).
  • mvn dependency:tree -Dverbose doesn't mention any of reflections-maven or jade-plugin-common at all. The command generates over 136k lines, so it was required to save the output into a file and perform the full-text-search. I am afras Maven 3 is the limit here as far as I understand from this comment.
  • Using depgraph-maven-plugin gave me the very same negative result.
  • mvn dependency:analyze -DignoreNonCompile gives only an information that the artifacts were resolved and that where it ends. it doesn't really show anything useful.
    [INFO] --- reflections-maven:0.9.5:reflections (default) @ my-module ---
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections-maven:pom:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections-maven\0.9.5\reflections-maven-0.9.5.pom-[IJ]-artifactCoord=org.reflections:reflections-maven:pom:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections-maven:jar:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections-maven\0.9.5\reflections-maven-0.9.5.jar-[IJ]-artifactCoord=org.reflections:reflections-maven:jar:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections:jar:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections\0.9.5\reflections-0.9.5.jar-[IJ]-artifactCoord=org.reflections:reflections:jar:0.9.5-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=com.google.guava:guava:jar:r08-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\com\google\guava\guava\r08\guava-r08.jar-[IJ]-artifactCoord=com.google.guava:guava:jar:r08-[IJ]-error=
    ...
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\jfrog\maven\annomojo\maven-plugin-anno\1.4.0\maven-plugin-anno-1.4.0.jar-[IJ]-artifactCoord=org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.jfrog.jade.plugins.common:jade-plugin-common:jar:1.3.8-[IJ]-error=
    [IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\jfrog\jade\plugins\common\jade-plugin-common\1.3.8\jade-plugin-common-1.3.8.jar-[IJ]-artifactCoord=org.jfrog.jade.plugins.common:jade-plugin-common:jar:1.3.8-[IJ]-error=
    ...
    
  • Checking the artifacts using the reflections-maven from here, however, none of the artifacts mentioned appear in my project as well.

Question: If I don't have such JAR in the local repository, the build fails as the plugin is executed. In that case, how can I find a way any plugin (particularly reflections-maven in my case) is truly imported and executed in the project?

Feel free to ask for more info in the commens. I use IntelliJ Idea, Maven 3.3.9 and Java 7 if it matters.


Solution 1 (didn't work for me): I have tried to run mvn -Dverbose=true -Doutput=./effective-pom.xml help:effective-pom and both the normal and the verbose form of effective-pom displays the same output of reflections-maven plugin with no additional information about its origin. Since the file is rather big, I include a screenshot:

enter image description here

This might be an issue with my Maven 3.3.9 with a custom settings.xml and a specific IntelliJ Idea. I assume the verbose output would lead to the true origin.


Solution 2:

Upon installing Netbeans (I use IntelliJ Idea by default), the Effective tab of the POM editor finally led me to the true origin where the plugin is defined.

enter image description here

Sadly, IntelliJ Idea doesn't provide such navigation through its effective POM and navigating to the origin is virtually impossible without manual clicking through parent POMs.

Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
  • probably due to: "Openmind is now part of Accenture Interactive" ... https://www.openmindonline.it/ .... yea, **plugins** harder to "scan" than *dependencies*, please try: `mvn help:effective-pom > effective-pom.xml` (`&& grep 'reflections-maven' effective-pom.xml`;) – xerx593 Jan 01 '22 at 22:38
  • [help:effective-pom](https://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html) (netbeans has an extra view/tab for this;) – xerx593 Jan 01 '22 at 22:39
  • 1
    @xerx593 Yes, the `effective-pom.xml` shows indeed `reflections-maven` version `0.9.5` and execution with `process-classes` phase and `reflections` goal among plugins. However, it doesn't lead me to its origin. – Nikolas Charalambidis Jan 01 '22 at 23:05
  • " boolean 3.2.0 Output POM input location as comments." – xerx593 Jan 01 '22 at 23:13

1 Answers1

1

With Help:Effective-Pom:

mvn -Dverbose=true -Doutput=./effective-pom.xml help:effective-pom

We can analyze our "effective pom" (Pom#inheritance, Pom#super-Pom).

  • The verbose flag will also add the source pom (artifact) as a comment to each output line.
  • output sets an output file. (default: prints to console)

"inter alia" it allows us to locate/override any inherited plugin/dependency/"pom element".

Unfortunately the output generates:

  • for "trivial" projects "hundreds" lines of pom.
  • for "non-trivial" (spring-boot-starter), it gets easily into "ten-thousands" (lines of pom).

In we have a "Show effective Pom" command, which basically invokes the mentioned goal and shows the output (in community edition unfortunately!?) without "verbose".


has a "Effective" tab in its "Pom Editor":

  • scrolling/cursoring is here also "cumbersome", but we have "full":
  • "Navigation" (window) support
  • Text search
  • Code hints, etc...

(, "Graph" view also very nice...(and unique feature among "maven IDES (that i know)", and it can be installed un-rooted;)!


Update:

So the mojo seems to work as documented:

<verbose> boolean (since:)3.2.0 Output POM input location as comments.

Default value is: false.

User property is: verbose.

For verbose to have an effect, we need to:

<project ...>
 ...
 <build>
   <plugins>
     <artifactId>maven-help-plugin</artifactId>
     <version>3.2.0</version> <!-- or higher! -->
   </plugins>
 </build>
 ...
</project>

... respectively can (without pom modification):

mvn -Dverbose=true -Doutput=./eff.pom.xml \
  org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom
xerx593
  • 12,237
  • 5
  • 33
  • 64
  • I have tried also the verbose form of `effective-pom`, however, the generated file displays the same output of `reflections-maven` plugin with no additional information about its origin. I have updated my question with this information. Although I use IntelliJ Idea, I'll give Netbeans a try to view the graph. – Nikolas Charalambidis Jan 02 '22 at 12:07
  • sorry, simple problem: in cmd (seems) it is sufficient to `-Dverbose` in IDE (run configuration), better/explicitly: `-Dverbose=true` (otherwise it could also be interpreted as `-Dverbose=` (empty/unset/exactly the opposite of our pupose;) – xerx593 Jan 02 '22 at 12:43
  • The result is the same with `-Dverbose=true`. I have installed Netbeans and discovered out using the Effective view that the plugin is loaded from somewhere high at the chain of parent poms as long as the root of my project has a parent `pom`. The great thing is that Netbeans shows at the left side the **true** origin, although it is not a part of the project. Sadly, neither IntelliJ Idea nor any `mvn` command led me. Many thanks for help! – Nikolas Charalambidis Jan 02 '22 at 12:45
  • 1
    please see update: (try to) update the help-plugin, but having netbeans (on a usb drive;), you should never need that again ;) – xerx593 Jan 02 '22 at 13:23
  • The verbose parameter works using 3.8.3 Maven Wrapper on a simple Spring Boot project. For this my large legacy project, the verbose parameter doesn't print the comments out either because the version 3.3.9 with custom settings.xml might not work well or because the project is really big (effective POM has over 220k of lines). – Nikolas Charalambidis Jan 02 '22 at 13:27
  • 1
    dang, that's not "human readable"! :) Thanks for vote&accept! Hope could help you! (& others) – xerx593 Jan 02 '22 at 13:29
  • 1
    You basically resolved my issue :) The further readers should learn that `help:effective-pom` with `verbose` might be helpful, but it depends on Maven and IntelliJ Idea combination. Another solution is either grab Netbeans to display effective POM with a left panel showing the true origin... or manually check the parent POMs which I have completely forgot they existed :) – Nikolas Charalambidis Jan 02 '22 at 13:32