尽管Maven提供了功能强大的中央存储库机制,但在某些情况下,我们也许不想使用网络上的存储库,也不想制作一个本地存储库,而是希望像Ant那样直接在classpath中使用已存在的类库。
Maven的确提供了这样的一个方法。在下面的片断中:
必须用指定一个system依赖范围,然后用<systemPath>指定jar所在的绝对路径。
最后提醒大家要慎用此项功能,因为Maven的文档这样说:
Note that use of this property is discouraged and may be replaced in later versions.
Maven的确提供了这样的一个方法。在下面的片断中:
pom.xml 代码
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>system</scope>
- <systemPath>${basedir}/lib/easymock-2.2.jar</systemPath>
- </dependency>
必须用指定一个system依赖范围,然后用<systemPath>指定jar所在的绝对路径。
最后提醒大家要慎用此项功能,因为Maven的文档这样说:
Note that use of this property is discouraged and may be replaced in later versions.