Maven Command Dependencies

62 Views Asked by At

I am trying to execute "mvn license:add-third-part" on a server, that is not connected to the web. It's missing some dependencies. I tried to add them manually, but it says that still some transitive dependencies are missing. I there a way to display all dependencies by a Maven Command, including transitve ones? I know the

  • "mvn site"
  • "mvn dependency:tree"

Commands, but I dont know how to execute them on a Maven Command. Also did not found anything on the Codehouse Mojo Page, which created the Command.

  • did try to execute "mvn dependency:tree" on mvn license:add-third-part's folder, but didnt work as I assumed, cuase its no Maven Projekt
  • looked into "mvn license:add-third-part"'s Pom but there are only the direkt dependencies
  • added Dependcies manually -> lead to the "transitive Dependencies are missing" Warning
2

There are 2 best solutions below

3
Alexey R. On BEST ANSWER

I am not sure how you are going to resolve dependencies if your host is not connected to the Internet. However you can just create separate pom.xml (in some separate folder) and include there the only dependency of your plugin.

Say you are using plugin v2.0.0:

<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/license-maven-plugin -->
<dependency>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>license-maven-plugin</artifactId>
    <version>2.0.0</version>
</dependency>

Now inside that folder run mvn dependency:tree.

Another way is to use online service like: http://101coder.com/genTreeUI

0
J Fabian Meier On

Usually you resolve the problem by using a company Nexus/Artifactory that resolves the artifacts for you (from the web). Without this, it is hardly possible to run a normal build (like mvn clean deploy).

You can of course also run the command on a machine that is connected to the internet (with a fresh local repository) and then copy the downloaded dependencies over.