根据网站
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]
发布评论
评论(1)
我建议使用已发布的最新版本的 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