Im trying to build a project that has dependency on another project in Jenkins. It uses an environment variable in the POM to point to the right jars. So, basically, I need to set an environment variable for one project to point to the workspace of another one. Is there a way to do so?
Asked
Active
Viewed 4,546 times
0
-
if your second project is a dependency of the first one, running `mvn install`on the second should allow the first one to find the required jar on the local(jenkins) repository – jhamon Nov 27 '14 at 16:52
1 Answers
0
An answer: Environment Variable with Maven
Anyway, if your goal is to compile your maven project including other project libraries, i would recommend better to install your other project jars with mvn install-file ...
and the rely on repository dependencies instead of external jars. See http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/

Community
- 1
- 1

Andrés Oviedo
- 1,388
- 1
- 13
- 28
-
Let me rephrase the question a little bit - I can set environment variables just fine by checking "Inject environment variables to the build process" under "Build environment" and typing something like "MY_LIB_PATH = ${WORKSPACE}" But in this case Im setting my lib path to the workspace of the current project. So, naturally, the dependencies will not resolve. How would I set it to another project's workspace? – user1219387 Oct 28 '14 at 22:11
-
You can customize each job workspace as environment variables or system properties in jenkins. Then, you can make references to these variables in your jobs. – Andrés Oviedo Oct 28 '14 at 22:38