根据jar文件自动创建pom文件依赖

发布于 2025-01-03 05:52:55 字数 1172 浏览 1 评论 0原文

我有数百个 jar 文件分散在不同的项目中,我需要为其创建 pom 文件依赖项文件。我真的很想避免手动搜索每个 jar 文件并手动添加依赖项。我可以使用 API 或其他方式来完成此任务吗?

我尝试过使用通用的pom,如下所述: http: //maven.apache.org/plugins/maven-install-plugin/examples/generic-pom- Generation.html

使用此命令 - mvn install:install-file -Dfile=spring-webmvc-portlet-3.0.6.RELEASE -DgroupId=test -DartifactId=test -Dversion=version -Dpackaging=jar-DgeneratePom=true

但是生成的 pom 是否应该与 jar 文件不匹配?或者我需要自己添加这个

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>version</version>
  <packaging>jar-DgeneratePom=true</packaging>
  <description>POM was created from install:install-file</description>
</project>

I have hundreds of jar files scattered across different projects that I need to create pom file dependencies files for. I'd really like to avoid manually searching for every jar file and adding the dependency manually. Is there an API I can use to accomplish this task or some other way ?

Ive tried using a generic pom as described : http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html

Using this command - mvn install:install-file -Dfile=spring-webmvc-portlet-3.0.6.RELEASE -DgroupId=test -DartifactId=test -Dversion=version -Dpackaging=jar-DgeneratePom=true

But should the generated pom not match the jar file ? Or do I need to add this myself

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>version</version>
  <packaging>jar-DgeneratePom=true</packaging>
  <description>POM was created from install:install-file</description>
</project>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白龙吟 2025-01-10 05:52:55

我编写了一个生成 ivy 文件的脚本。它使用 jar 校验和来识别 Maven 中心中的匹配模块。

https://github.com/myspotontheweb/ant2ivy

该解决方案可用于生成 Maven POM。

I wrote a script that generates an ivy file. It uses the jar checksums to identify the matching modules in Maven central.

https://github.com/myspotontheweb/ant2ivy

This solution could be adapted to generate a Maven POM.

甜嗑 2025-01-10 05:52:55

您可以创建一个使用 Maven 安装插件生成通用 POM 的 bash 脚本。

请参阅 http://maven.apache.org/插件/maven-install-plugin/examples/generic-pom- Generation.html

You may create a bash script which uses the Maven Install plugin to produce a generic POM.

See http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文