Could not set unknown property 'classifier' for task ':idl-parser:sourceJar' of type org.gradle.api.tasks.bundling.Jar

huangapple go评论96阅读模式
英文:

Could not set unknown property 'classifier' for task ':idl-parser:sourceJar' of type org.gradle.api.tasks.bundling.Jar

问题

安装Fast-DDS-Gen时遇到了问题,执行gradle assemble命令时出现错误。错误信息显示在文件/Users/scott/Fast-DDS-Gen/thirdparty/idl-parser/build.gradle的第79行,提示无法识别属性classifier。请尝试以下解决方法:

  1. 确保你的Gradle版本是8.0.2。
  2. 检查/Users/scott/Fast-DDS-Gen/thirdparty/idl-parser/build.gradle文件的第79行,确保没有拼写错误,特别是classifier属性。
  3. 尝试运行带有--stacktrace选项的命令,以获取详细的堆栈跟踪信息,这可能会提供有关问题的更多上下文。
  4. 检查Gradle的官方文档或社区支持,看看是否有关于此错误的已知解决方法。

希望这些信息对你有所帮助。

英文:

all. I'm currently working on the installation of Fast-DDS-Gen on my MacOS; however, the installation failed as I met the below errors. How could I solve this issue?

This is the URL of official website: https://fast-dds.docs.eprosima.com/en/latest/installation/sources/sources_mac.html

Here is the instructions from the official website:

brew install gradle

cd ~
git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git
cd Fast-DDS-Gen
gradle assemble

when I executed the command gradle assemble, I met the following error:

> Task :buildIDLParser FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/scott/Fast-DDS-Gen/thirdparty/idl-parser/build.gradle' line: 79

* What went wrong:
A problem occurred evaluating project ':idl-parser'.
> Could not set unknown property 'classifier' for task ':idl-parser:sourceJar' of type org.gradle.api.tasks.bundling.Jar.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
2 actionable tasks: 2 executed

Here is my gradle info:

------------------------------------------------------------
Gradle 8.0.2
------------------------------------------------------------

Build time:   2023-03-03 16:41:37 UTC
Revision:     7d6581558e226a580d91d399f7dfb9e3095c2b1d

Kotlin:       1.8.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          19.0.2 (Homebrew 19.0.2)
OS:           Mac OS X 12.3.1 x86_64


答案1

得分: 23

Gradle 8 不再允许在 Jar 任务中使用 classifier
必须改用 archiveClassifier

详见 https://docs.gradle.org/current/userguide/upgrading_version_7.html

AbstractArchiveTask API 清理

已移除AbstractArchiveTask任务类型的已弃用的属性,包括appendix、archiveName、archivePath、baseName、classifier、desintationDir、extension和version。请改用archiveAppendix、archiveFileName、archiveFile、archiveBaseName、archiveClassifier、destinationDirectory、archiveExtension和archiveVersion属性。

(在官方文档 https://docs.gradle.org/current/javadoc/org/gradle/jvm/tasks/Jar.html 中只提到了新属性/属性 archiveClassifier)。

当您想要在此项目中使用Gradle 8时,必须更改构建文件以使其与Gradle 8兼容。

英文:

Gradle 8 does no longer allow classifier inside Jar task.
archiveClassifier must be used instead.

See https://docs.gradle.org/current/userguide/upgrading_version_7.html

> AbstractArchiveTask API Cleanup
>
> The deprecated appendix, archiveName, archivePath, baseName,
> classifier, desintationDir, extension and version properties of the
> AbstractArchiveTask task type have been removed. Use the
> archiveAppendix, archiveFileName , archiveFile, archiveBaseName,
> archiveClassifier, destinationDirectory, archiveExtension and
> archiveVersion properties instead.

(At the official documentation at https://docs.gradle.org/current/javadoc/org/gradle/jvm/tasks/Jar.html only the new property/attribute archiveClassifier is mentioned now.)

When you want to use Gradle 8 with this project the build files must be changed to make them Gradle 8 compatible.

huangapple
  • 本文由 发表于 2023年3月7日 18:35:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75660848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定