为我的文本文件中的所有 jar 名称/版本生成 pom.xml 文件(带有依赖项)

问题描述 投票:0回答:1

我在文本文件中列出了大量的 jar 及其版本。 例如:

  • spring-jdbc-4.3.6.RELEASE.jar
  • commons-codec.jar
  • commons-fileupload.jar

。 。 。 .

此列表包含 500 多个罐子。

问题:我需要一个包含所有这些 jars 作为依赖项的 pom.xml。 我需要这个来在 github 中进行 GHAS 扫描以确定 EOL

java maven github pom.xml maven-dependency
1个回答
0
投票

任何由 maven 构建的 jar 文件都应该在

pom.properties
下有
META-INF\maven\${groupId}\${artifactId}
文件。此
pom.properties
文件应包含
groupId
artifactId
version

我个人会编写一个 gradle/groovy 脚本来迭代 jar 文件列表,提取

pom.properties
文件并编写
pom.xml
片段(因为 gradle 有非常好的 api 用于迭代文件和从 zipfile 中读取)。

但是编写一个 java main 来做类似的事情就足够简单了(使用

ZipInputStream

© www.soinside.com 2019 - 2024. All rights reserved.