【发布时间】:2020-05-25 14:06:57
【问题描述】:
我有 2 个 .zip 文件:shared-lib-windows.zip 和 shared-lib-linux.zip。 maven 依赖 jar 在 WEB-INF/lib/ 下查找 shared-lib 目录,并期望 .exe 或 .out 文件存在于 shared-lib 目录中。
如何在我的 pom.xml 中设置 .zip 文件,以便拾取适当的 zip 文件,解压缩到重命名的(共享库,不带 -os)目录?
我已经将 maven 依赖项(jar)设置为:
<profiles>
<profile>
<id>Linux</id>
<dependencies>
<dependency>
<groupId>com.dependency</groupId>
<artifactId>depedency-linux</artifactId>
<version>0.0.9</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>Windows</id>
<dependencies>
<dependency>
<groupId>com.dependency</groupId>
<artifactId>dependency-windows</artifactId>
<version>0.0.9</version>
</dependency>
</dependencies>
</profile>
</profiles>
现在我只想让 Maven 从 src/main/resources 或 .m2/.../ 中提取 .zip 文件并施展魔法!
我查看了建议使用 maven-ant-plugin 的答案,但有人提到应该是 uncool。
[编辑:添加信息] 我有一个打包为 .war 并部署到 Tomcat 的 Maven Web 项目。 此外,.exe/.out 文件是第 3 方依赖项,大小分别为 120/150 MB。由于我的 git 不支持大文件并且二进制文件不会更新,因此我将其压缩并添加到我的 Git 管理的 Maven 网络项目中。
【问题讨论】:
-
你有一个WEB-INF目录?这是否意味着您有一个 Web 应用程序?哪个部署到哪里?雄猫?
-
为什么 zip 文件是 Maven 工件??
-
@khmarbaise 和 Thorbjørn Ravn Andersen,我已经用要求的信息更新了问题。