In my maven project, I'm creating a jar locally and specifying it in pom as a dependency. In GitHub action install step is working mvn install:install-file
and it is installing jar at location /root/.m2/repository/
.
But in the next command to run tests mvn clean test
it's checking that dependency in maven central and failing. How do we use dependency locally installed in case of GitHub action?
Asked
Active
Viewed 876 times
4

Ashish Chopra
- 1,413
- 9
- 23
-
1First of all, when you build a jar, you should usually call `mvn install` instead of `mvn install:install`. If the jar is external, use `mvn install:install-file`. Futhermore, I would check whether the local repository "survives" to the next maven call and is really the same. – J Fabian Meier Sep 24 '19 at 18:54
-
Changes to the workspace should persist between job steps, but not between jobs. If the dependency is there in the next step and it's still failing, then maybe this answer will help. https://stackoverflow.com/questions/33548395/how-do-i-force-maven-to-use-my-local-repository-rather-than-going-out-to-remote/33584084#33584084 – peterevans Sep 24 '19 at 23:54
-
@JFMeier yeah my bad, updated the question, I was using mvn install:install-file only. – Ashish Chopra Sep 25 '19 at 03:15