I’d like to mvn install:install-file artifact A excluding artifact X.
A does not depend directly on X, yet down the dependency tree there are several dependencies for X.
What would be the command to perform this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you just run install:install-file on a jar file without
-DpomFile=something, it will create a pom with no dependencies, so there’s nothing to exclude. The ‘X’ dependency won’t be represented at all.If you pass in a pom file via
-DpomFile=POMFILE, then you have the dependency structure in there, and it can include whatever exclusions you need. If you put in a dependency on X, and it in turn depends on Y, you can add an exclusion to the X dependency.A comment from the OP suggests that this has nothing to do with install:install-file.
There is some artifact ‘A’ with a rich and complex dependency tree, which transitively reaches some artifact ‘B’ at many points. How do cope with B not being available if, in fact, it’s not actually needed in the classpath?
The only solution here is to add exclusions to the POMs that reference A. Instead of trying to change the pom of A to exclude B, you have to add the exclusion of B in your own poms as part of the dependency on A. There’s no other way.