Clarify what you’re doing here and what isn’t found. Each built JAR only contains the classes of its own project by default. It sounds like you’re saying everything is great until you publish a JAR, but none of its dependencies.
derby.jar is not in our artifactory but we access it from JAVA_HOME path.
1)When we execute a gradle build followed by test task locally, it succeeds (so derby.jar is in classpath here)
2)We also publish the jar and execute the tests in a different server than in which it was built. The tests are failing in this step with a ClassNotFoundException on derby classes.
What I understand now is that local file dependencies are not included in the pom.xml(correct me if I am wrong)
So in (2) above, derby.jar is not in classpath.
How can I solve this?
Is there a way to include derby path location in pom.xml(by referring to JAVA_HOME env variable).
Or are there any other way to solve this?
@ddimitrov,
You mean add the folder containing derby.jar as a repository?
Rajesh, this time tried to read your posts carefully, so I can give you better answer, but I am utterly confused about what are you trying to do.
Your last post is hinting that you are building and the derby jar is there (how do you do this).
Then you run the tests in other place and the derby jar is not there (how do you do this, what is different than the first time)?
I.e. are you using Gradle both to build and run the tests? Is it the same repository you use? Do you use the Gradle test runner? Do you have any special options for the tests? If you run the tests when you build the jar do they find derby, or is it still missing? How did you declare the derby dependency (is it “compileOnly” by any chance)? Do you massage the configurations in your build file?
At this stage, the best thing you can do is provide an example project. Otherwise we are shooting in the dark.