在我的项目中,我使用的是 maven,因为我在我的项目 pom.xml 中添加了第三方库依赖项
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r6</version>
</dependency>
现在所以这个 jar 在编译时出现在我的本地仓库中,我可以在 maven 依赖项中看到。现在我想制作一个超级 jar,其中包括三个 jar 文件,两个在我的 eclipse 工作空间中,一个在本地 repo 中。所以我可以使用下面的代码包含两个文件
<property name="First.jar" value="${basedir}/../Some/bin/SomeFirst-${project.version}.jar" />
<available file="${First.jar}" type="file" property="First-found" />
<fail unless="First-found" message="ERROR: failed to find First.jar, looked here: ${First.jar}" />
<!-- verify second.jar is available -->
<property name="second.jar" value="${basedir}/bin/some-project-name-${project.version}.jar" />
<available file="${second.jar}" type="file" property="second-found" />
<fail unless="second-found" message="ERROR: failed to find second.jar, looked here: ${second.jar}" />
<!-- glue all jars together into a super jar -->
<zip destfile="${super.jar}">
<zipfileset src="${Second.jar}" />
<zipfileset src="${First.jar}" excludes="META-INF/*,connectors/*" />
<zipfileset src="Need third file relative path here " excludes="META-INF/*" />
</zip>
我可以使用完整路径,例如:
<zipfileset src="C:/Users/xxx/.m2/repository/com/google/android/support-v4/r7/support-v4-r7.jar" />
但我确信这不适用于其他系统。 那么我如何将 support-v4-r7.jar 从本地 repo 相对引用到 Pom.xml。