Reputation: 9085
In my pom.xml
of com.test:Service:1.0
, I have a dependency on some local jar: com.test:Parser:1.0
I want to resolve all dependencies except for it, since I install it manually to my local maven. Resolve command:
mvn -B dependency:resolve -DincludeParents=true
But it fails on:
[ERROR] Failed to execute goal on project Service: Could not resolve dependencies for project com.test:Service:jar:1.0: Could not find artifact com.test:Parser:jar:1.0 in central (https://repo.maven.apache.org/maven2)
Then I tried to add the options
-DexcludeGroupIds=com.test -DexcludeArtifactIds=Parser
but am still getting the same error. Am I misusing the options?
Reference: http://maven.apache.org/plugins/maven-dependency-plugin/resolve-mojo.html
Upvotes: 2
Views: 1776
Reputation: 1532
I'm using 3.8.6 and it looks like go-offline works with exclude*, but resolve does not:
mvn dependency:go-offline -DexcludeGroupIds=com.test
According to: https://maven.apache.org/plugins/maven-dependency-plugin/index.html
dependency:go-offline tells Maven to resolve everything this project is dependent on (dependencies, plugins, reports) in preparation for going offline.
dependency:resolve tells Maven to resolve all dependencies and displays the version.
Upvotes: 1
Reputation: 9085
This seems to simply be a bug. See
https://issues.apache.org/jira/browse/MDEP-568
https://github.com/apache/maven-dependency-plugin/pull/2
The solution, as proposed in the above threads, is to use a different library: https://github.com/qaware/go-offline-maven-plugin
In your pom.xml
add the plugin:
<plugin>
<groupId>de.qaware.maven</groupId>
<artifactId>go-offline-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<dynamicDependencies>
</dynamicDependencies>
</configuration>
</plugin>
Then use the command mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
with the required options.
Upvotes: 0