Finding SNAPSHOT dependencies without compiling first

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

Finding SNAPSHOT dependencies without compiling first

Francois MAROT
Hello all,

I have a simple requirement: I would like to determine very fast if my
multi-module project has any SNAPSHOT dependency.

First try was with the /mvn dependency:tree / command and grepping for the
word SNAPSHOT. But the dependency plugin seems to use the repository
dependencies, so it is not able to resolve inter-module dependencies without
first having to INSTALL the dependencies.

A workaround is to use:
/mvn compile dependency:tree -Dmaven.main.skip=true/
It seems this command initializes enough of the build plan so that Maven is
able to resolve internal (inter-modules) dependencies. The
"/maven.main.skip/" is used to optimize the speed by skipping the actual
compilation. In my case I had to also add a /-DskipSourceGeneration=true/
because a source generation step was relying on the source being compiled.

I also tried with the enforcer plugin which now allows rules to be passed on
the command line. But the result is the same, the build plan seems not to be
build hence dependency resolution is done through the repository and fails
if all jars are not INSTALLED first. As previously the workaround is to
force a fake "compile" step:

/mvn clean compile
org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce
-Drules=requireReleaseDeps -Dmaven.main.skip=true
-DskipSourceGeneration=true/

So the question is: is there really no way to have the full dependency graph
without all those hacks ?



--
Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Finding SNAPSHOT dependencies without compiling first

Nick_S
Hello,

I don't think I can reproduce your problem. I've tried this on one of my
multimodules.

1. Remove everything of the multimodule from the local repository.
2. Run mvn dependency:tree -Dincludes=*:*:*:*-SNAPSHOT
Output:
https://gist.github.com/nickstolwijk/4042c9ca4a71bc4886ac528b6621e5c6
3. Check local repository, nothing of my project is there.

My output shows SNAPSHOT dependencies inside my project.

Hth,

Nick Stolwijk

~~~ Try to leave this world a little better than you found it and, when
your turn comes to die, you can die happy in feeling that at any rate you
have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Wed, May 6, 2020 at 11:14 AM Francois MAROT <[hidden email]>
wrote:

> Hello all,
>
> I have a simple requirement: I would like to determine very fast if my
> multi-module project has any SNAPSHOT dependency.
>
> First try was with the /mvn dependency:tree / command and grepping for the
> word SNAPSHOT. But the dependency plugin seems to use the repository
> dependencies, so it is not able to resolve inter-module dependencies
> without
> first having to INSTALL the dependencies.
>
> A workaround is to use:
> /mvn compile dependency:tree -Dmaven.main.skip=true/
> It seems this command initializes enough of the build plan so that Maven is
> able to resolve internal (inter-modules) dependencies. The
> "/maven.main.skip/" is used to optimize the speed by skipping the actual
> compilation. In my case I had to also add a /-DskipSourceGeneration=true/
> because a source generation step was relying on the source being compiled.
>
> I also tried with the enforcer plugin which now allows rules to be passed
> on
> the command line. But the result is the same, the build plan seems not to
> be
> build hence dependency resolution is done through the repository and fails
> if all jars are not INSTALLED first. As previously the workaround is to
> force a fake "compile" step:
>
> /mvn clean compile
> org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce
> -Drules=requireReleaseDeps -Dmaven.main.skip=true
> -DskipSourceGeneration=true/
>
> So the question is: is there really no way to have the full dependency
> graph
> without all those hacks ?
>
>
>
> --
> Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>