dash-licenses icon indicating copy to clipboard operation
dash-licenses copied to clipboard

Possible Enhancement for Maven Example in the README.

Open sbernard31 opened this issue 4 years ago • 4 comments

I tried the example provided in the README :

$ mvn verify dependency:list -DskipTests -Dmaven.javadoc.skip=true -DappendOutput=true -DoutputFile=maven.deps
$ java -jar org.eclipse.dash.licenses-<version>.jar maven.deps
...
$ _

Maybe I missed something but I feel we can get the same result with a more simple and faster way like this, or ?

$ mvn  dependency:list -DappendOutput=true -DoutputFile=maven.deps
$ java -jar org.eclipse.dash.licenses-<version>.jar maven.deps
...
$ _

Another point about this, I have a multi-module maven project. And when I tried the example, I spend some time to understand why my maven.deps file was almost empty.

The following files have been resolved:
   none

The reason was because I provide a relative path to -DoutputFile like in the example and so face this behavior : https://issues.apache.org/jira/browse/MDEP-542

I would advice to change the example by :

$ mvn  dependency:list -DappendOutput=true -DoutputFile=/an/absolute/path/to/maven.deps
$ java -jar org.eclipse.dash.licenses-<version>.jar /an/absolute/path/to/maven.deps
...
$ _

And/Or adding a comment about why an absolute path should be used for multi-module maven project, e.g :

If your project is a multi-module maven project, you should provide an absolute path to -DoutpuFile to list all dependencies in the same file. (see https://issues.apache.org/jira/browse/MDEP-542)

sbernard31 avatar Oct 08 '21 09:10 sbernard31

The problem is that the dependency:list plugin fails if the project hasn't been built (at least in many cases). I've determined that the verify goal does the minimum that we need to set up the project for dependency:list to work.

The relative path problem is spot-on. Thanks for that. Is there any chance that you can provide a pull request?

waynebeaton avatar Oct 08 '21 15:10 waynebeaton

Yep I can do that.

Not related but there is also a comment copy/paste error that need to be fixed in LicenseCheckMojo. I will fix it too.

(I will try to do that next week)

sbernard31 avatar Oct 08 '21 16:10 sbernard31

Not related but there is also a comment copy/paste error that need to be fixed in LicenseCheckMojo. I will fix it too.

Well that's embarrassing :-)

waynebeaton avatar Oct 08 '21 16:10 waynebeaton

The problem is that the dependency:list plugin fails if the project hasn't been built (at least in many cases). I've determined that the verify goal does the minimum that we need to set up the project for dependency:list to work.

I tried to reproduce this with my project. Tested with a fresh clone. And it works for me. My root pom.xml forces the maven-dependency-plugin to the version 3.1.1. so I changed it to test with the default one (v2.8) and did the test again and it sill works for me. I guess I'm not in the case where that should failed.

sbernard31 avatar Oct 11 '21 09:10 sbernard31