我相信这是非常非正统的,但是,我只是想知道这是否可能.所以这样的东西:
<dependency> <groupId>foo</groupId> <artifactId>foo</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/lib/foo/*.jar</systemPath> </dependency>
解决方法
system: This dependency is required in some phase of your
project’s lifecycle,but is
system-specific. Use of this scope
is discouraged: This is considered an
“advanced” kind of feature and should
only be used when you truly understand
all the ramifications of its use,
which can be extremely hard if not
actually impossible to quantify.
This scope by definition renders your
build non-portable. It may be
necessary in certain edge cases. The
system scope includes the
<systemPath>
element which points to
the physical location of this
dependency on the local machine. It is
thus used to refer to some artifact
expected to be present on the given
local machine an not in a repository;
and whose path may vary
machine-to-machine. ThesystemPath
element can refer to environment
variables in its path:${JAVA_HOME}
for instance.
现在,为了严格地回答你的问题,如果依赖关系在其Class-Path条目中相对地列出了一个MANIFEST.MF,则列出一个指向几个jar的系统范围的依赖关系是可能的.这样的东西(假设“根”依赖在lib中):
Class-Path: ../lib/bar.jar ../lib/foo.jar
但我不推荐这种方法,特别是在你的具体情况下.相反,请看这个previous answer,我将介绍如何设置基于文件的存储库.