How do I use a Windows environment variable to specify where a jar is located in an Eclipse project build path?
The JAVA_HOME environment variable for example could be in a different location on the server than on my PC, but if I have JAVA_HOME set as an environment variable on both machines, how can I specify in Eclipse to use a jar in the JAVA_HOME so it is the same on both machines?
If your using Maven, just put an entry in your pom.xml like this:
<dependency>
<artifactId>com.mysite</artifactId>
<groupId>mylib</groupId>
<version>${mylib.version}</version>
<scope>system</scope>
<systemPath>${basedir}/lib/mylib-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>
This requires you install the Maven M2E plugin for Eclipse.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.