Search code examples
gradledata-distribution-service

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


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



Solution

  • 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.