My application has a dependency to jaxb-api.jar and jaxb-impl.jar. How can I remove those two dependencies from project class path only while running junit
?
(I need the same jars available in class path for application to run. Need to remove only during junit
test case execution.)
Edit: I am using Gradle
Asked
Active
Viewed 683 times
-2

Chetan Joshi
- 5,582
- 4
- 30
- 43

User_1940878
- 321
- 1
- 6
- 25
-
Are you using maven? – P3trur0 Sep 25 '17 at 11:53
-
I am using gradle. The problem is I need those dependencies while running the application and need to exclude while junit runtime only. – User_1940878 Sep 25 '17 at 12:00
-
Possible duplicate of [Gradle Test Dependency](https://stackoverflow.com/questions/5144325/gradle-test-dependency) – fantaghirocco Sep 25 '17 at 12:02
-
@fantaghirocco its not the same! Adding a dependency for test class alone is fine(We can add under testCompile). But how to remove a dependency for test class alone? – User_1940878 Sep 25 '17 at 12:08
1 Answers
-1
If you are using maven, it should help to set the "scope" of the dependencies. You can find information about Scopes under this link: https://howtodoinjava.com/maven/maven-dependency-scopes/

Crux lp
- 166
- 1
- 12
-
It is recommended to include necessary parts of the reference link in the answer – Ibo Oct 05 '17 at 03:10