pom中参考maven shade插件3.3.1-SNAPSHOT

发布于 2025-01-15 01:10:56 字数 1970 浏览 3 评论 0 原文

根据网站

https://maven。 apache.org/plugins-archives/maven-shade-plugin-LATEST/shade-mojo.html

Maven Shade 插件的最新版本是3.3.1-SNAPSHOT 自 2021 年 7 月 14 日起存在。

为了引用早期版本 3.3.0-SNAPSHOT,我在 pom 中使用了以下引用

<pluginRepositories>
    <pluginRepository>
        <id>maven-snapshots</id>
        <url>https://repository.apache.org/content/repositories/snapshots/</url>
    </pluginRepository>
</pluginRepositories>

我的问题如何在 pom.xml 中引用 3.3.1-SNAPSHOT 运行 mvn install 时出现以下错误:

ERROR] 无法执行目标 org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT:shade ([ ...]) 在项目 [...] 上:目标 org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT:shade 的执行 [...]失败:插件 org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT 或其依赖项之一无法解析:无法在 org.apache.maven.plugins:maven-shade-plugin 收集依赖项:jar:3.3.1-20220317.155034-43 -> org.slf4j:slf4j-api:jar:1.7.32:无法读取 org.slf4j:slf4j-api:jar:1.7.32 的工件描述符:无法传输工件 org.slf4j:slf4j-api:pom:1.7。 32 个来自/到 Maven 快照(https://repository.apache.org/content/repositories/snapshots/):https://repository.apache.org/content/repositories/snapshots/org/slf4j/slf4j-api/1.7.32/ 传输失败slf4j-api-1.7.32.pom:未知主机repository.apache.org:名称解析暂时失败 - > [求助1]

那么是slf4j的问题吗?我能以某种方式解决这个问题吗?

谢谢你!

PS:我想尝试最新版本的原因是因为我在运行 mvn install 时遇到以下错误:

使用 maven-shade-plugin 3.2.4 :

[错误] 无法在项目 owl 上执行目标 org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (owlex): 创建着色 jar 时出错: 不支持的类文件主要版本 61 -> [帮助 1]

使用 maven-shade-plugin 3.3.0-SNAPSHOT:

[ERROR] 无法执行目标 org.apache.maven.plugins:maven-shade-plugin :3.3.0-SNAPSHOT:项目 owl 上的阴影(owlex):创建阴影 jar 时出错:记录需要 ASM8 -> [帮助1]

According to the site

https://maven.apache.org/plugins-archives/maven-shade-plugin-LATEST/shade-mojo.html

the latest version of the maven shade plugin is 3.3.1-SNAPSHOT and exists since 2021-07-14.

To reference the earlier version 3.3.0-SNAPSHOT, I used the following reference in the pom

<pluginRepositories>
    <pluginRepository>
        <id>maven-snapshots</id>
        <url>https://repository.apache.org/content/repositories/snapshots/</url>
    </pluginRepository>
</pluginRepositories>

My question how to reference 3.3.1-SNAPSHOT in the pom.
When running mvn install I am getting the following error:

ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT:shade ([...]) on project [...]: Execution [...] of goal org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT:shade failed: Plugin org.apache.maven.plugins:maven-shade-plugin:3.3.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-shade-plugin:jar:3.3.1-20220317.155034-43 -> org.slf4j:slf4j-api:jar:1.7.32: Failed to read artifact descriptor for org.slf4j:slf4j-api:jar:1.7.32: Could not transfer artifact org.slf4j:slf4j-api:pom:1.7.32 from/to maven-snapshots (https://repository.apache.org/content/repositories/snapshots/): transfer failed for https://repository.apache.org/content/repositories/snapshots/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.pom: Unknown host repository.apache.org: Temporary failure in name resolution -> [Help 1]

So is the problem with slf4j? Can I resolve this somehow?

Thank you!

PS: the reason why i would like to try out the latest version is because I am getting the following errors when running mvn install:

with maven-shade-plugin 3.2.4:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (owlex) on project owl: Error creating shaded jar: Unsupported class file major version 61 -> [Help 1]

with maven-shade-plugin 3.3.0-SNAPSHOT:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.3.0-SNAPSHOT:shade (owlex) on project owl: Error creating shaded jar: Records requires ASM8 -> [Help 1]

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

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

发布评论

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

评论(1

蒲公英的约定 2025-01-22 01:10:56

我建议使用已发布的最新版本的 maven-shade-plugin 版本 3.3.0。

这将正确处理 JDK 17。

https://www.mail-archive.com/[电子邮件受保护]/msg01066.html

I can recommend to use the most recent version of maven-shade-plugin version 3.3.0 which has been released.

This will handle JDK 17 correctly.

https://www.mail-archive.com/[email protected]/msg01066.html

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