# Gradle Version Catalog and JavaFX Dependencies - Classifier

**URL:** <https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826>\
**Category:** Help/Discuss\
**Created:** [August 25, 2021, 9:11pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826 "2021-08-25T21:11:00Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nyanyan](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Nyanyan](https://discuss.gradle.org/u/Nyanyan)\
**Post date:** [August 25, 2021, 9:11pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/1 "2021-08-25T21:11:00Z")

</div>

I am currently testing Version Catalog on a JavaFX project of mine. Therefore I need to update the dependencies and found something where I am stuck.

My dependencies are looking like this:

```gradle
dependencies {
    implementation("org.openjfx:javafx-base:11.0.2:win")
    implementation("org.openjfx:javafx-fxml:11.0.2:win")
    implementation("org.openjfx:javafx-graphics:11.0.2:win")
    implementation("org.openjfx:javafx-controls:11.0.2:win")
    implementation("org.openjfx:javafx-web:11.0.2:win")
}

```

I’ve created a `libs.versions.toml` file to reference the  
dependencies later

```gradle
[versions]
javafx-win = "11.0.2:win"

[libraries]
javafx-base-win = { module = "org.openjfx:javafx-base", version.ref = "javafx-win" }
javafx-controls-win = { module = "org.openjfx:javafx-controls", version.ref = "javafx-win" }
javafx-fxml-win = { module = "org.openjfx:javafx-fxml", version.ref = "javafx-win" }
javafx-graphics-win = { module = "org.openjfx:javafx-graphics", version.ref = "javafx-win" }
javafx-media-win = { module = "org.openjfx:javafx-media", version.ref = "javafx-win" }
javafx-web-win = { module = "org.openjfx:javafx-web", version.ref = "javafx-win" }

[bundles]
javafx-win = ["javafx-base-win", "javafx-controls-win", "javafx-fxml-win", "javafx-graphics-win",
  "javafx-media-win", "javafx-web-win"]

```

The problem that occurs now is that the depdendencies could not be found e.g.

```gradle
dependencies {
   implementation(libs.bundles.javafx.win)
}

```

```gradle
> Could not find org.openjfx:javafx-base:11.0.2-win.
        Searched in the following locations:
          - https://repo.maven.apache.org/maven2/org/openjfx/javafx-base/11.0.2-win/javafx-base-11.0.2-win.pom
        If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
        Required by:
            project :

```

404 Not Found to the website: [https://repo.maven.apache.org/maven2/org/openjfx/javafx-base/11.0.2-win/javafx-base-11.0.2-win.pom](https://repo.maven.apache.org/maven2/org/openjfx/javafx-base/11.0.2-win/javafx-base-11.0.2-win.pom)

Probably this path should be correct: [Central Repository: org/openjfx/javafx-base/11.0.2](https://repo.maven.apache.org/maven2/org/openjfx/javafx-base/11.0.2/)

I would appreciate the help how I should configure the `toml`file.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [August 25, 2021, 10:18pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/2 "2021-08-25T22:18:38Z")

</div>

The classifier is not part of the version catalog.  
There is no way to specify the classifier in the version catalog.  
The classifier is part of the actual usage of the version catalog entry.

---

<div class="post-metadata">

**Author:** ![Nyanyan](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Nyanyan](https://discuss.gradle.org/u/Nyanyan)\
**Post date:** [August 26, 2021, 9:05am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/3 "2021-08-26T09:05:38Z")

</div>

Thanks for the reply!

---

<div class="post-metadata">

**Author:** ![Mathias](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mathias](https://discuss.gradle.org/u/Mathias)\
**Post date:** [October 7, 2021, 3:25pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/4 "2021-10-07T15:25:19Z")

</div>

How does the notation looks like if i want to add a classifier when i use a version catalog entry?

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [October 7, 2021, 3:35pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/5 "2021-10-07T15:35:40Z")

</div>

```gradle
implementation(variantOf(libs.foo) {
    classifier("bar")
})

```

---

<div class="post-metadata">

**Author:** ![Mathias](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mathias](https://discuss.gradle.org/u/Mathias)\
**Post date:** [October 8, 2021, 9:35am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/6 "2021-10-08T09:35:29Z")

</div>

thx for the reply. it didn’t work for me. I tried  
implementation (variantOf(libs.log4j) {classifier(“sources”)})  
which resulted in Could not find method variantOf() for arguments…

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [October 8, 2021, 9:55am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/7 "2021-10-08T09:55:31Z")

</div>

Works perfectly fine here.  
How does the message continue after “arguments”?  
Can you show an [MCVE](https://stackoverflow.com/help/mcve)?

---

<div class="post-metadata">

**Author:** ![Mathias](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mathias](https://discuss.gradle.org/u/Mathias)\
**Post date:** [October 8, 2021, 10:25am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/8 "2021-10-08T10:25:43Z")

</div>

the complete message is

```plaintext
> Could not find method variantOf() for arguments [org.gradle.accessors.dm.LibrariesForLibs$Log4jLibraryAccessors@5b8d0fdd, build_9hi4efpzfo07zsuacu9s85ghk$_run_closure4$_closure26@59df85f] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

```

my Catalog looks like this  
build.gralde of catalog project:

```groovy
catalog { versionCatalog { alias("log4j").to("log4j", "log4j").version("1.2.16") }}

```

the catalog is loaded via settings.gradle:

```groovy
enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
    repositories { maven {url "${nexusUrl}/plugins/"} }
    versionCatalogs { libs { from("de.finkonsens.muest:versionCatalog:+") } } 
}

```

builde gradle:

```groovy
plugins {
    id "java"
    id "java-library"
    id "maven-publish"
}

dependencies { implementation (variantOf(libs.log4j) {classifier("sources")}) }

```

thx for your patiance

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [October 8, 2021, 10:56am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/9 "2021-10-08T10:56:41Z")

</div>

Works perfectly fine here.  
Again the question, can you please provide an [MCVE](https://stackoverflow.com/help/mcve)?  
I’m not asking for that for fun.  
But there is probably something very specific you do wrong.

---

<div class="post-metadata">

**Author:** ![Mathias](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@Mathias](https://discuss.gradle.org/u/Mathias)\
**Post date:** [October 8, 2021, 12:17pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/10 "2021-10-08T12:17:10Z")

</div>

thx alot, i found it by reducing the catalog to 1 line  
to get the sources i defined a source lib alias(“log4j-sources”).to(“log4j”, “log4j”).version(“1.2.16-sources”) that caused the error

i did also open a [thread](https://discuss.gradle.org/t/version-catalog-and-module-cache/41153) yesterday with exactly this catalog. My problem there is, if i edit the catalog, publish it to nexus i have to delete it from the cache first to see the changes. Is there anything i can do to prevent the catalog.jar from beeing cached?

---

<div class="post-metadata">

**Author:** ![QuasiG](https://avatars.discourse-cdn.com/v4/letter/q/ed8c4c/32.png) [@QuasiG](https://discuss.gradle.org/u/QuasiG)\
**Post date:** [March 26, 2024, 9:45am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/11 "2024-03-26T09:45:04Z")

</div>

Hello,  
I have the same question as the OP.  
I have a bundle defined in my toml catalog. But when I try to set a classifier using this syntax…

```gradle
implementation (variantOf(libs.bundles.javaFxWinLibs) {
            classifier('win')
        })

```

I get this error message  
`Could not set unknown property 'classifier' for org.openjfx:javafx-base:17.0.8 of type org.gradle.api.internal.artifacts.dependencies.DefaultMutableMinimalDependency.`

So the question is - is it possible to set a classifier for a bundle? And if yes what is the syntax please?  
Thanks.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [March 26, 2024, 11:41am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/12 "2024-03-26T11:41:23Z")

</div>

Actually, you should not request the classifier manually.  
By that you for example loose the dependency information.  
Since version 0.1.0 the JavaFX Gradle plugin was significantly improved to use a component metadata rule to properly model the OS-specific and architecture-specific artifacts as feature variants.  
It even by default configures the runtime classpath and compile classpath of all source sets to the OS and architecture of the currently used operating system if you do not configure something manually and also easily allows to do cross-platform builds.

---

<div class="post-metadata">

**Author:** ![QuasiG](https://avatars.discourse-cdn.com/v4/letter/q/ed8c4c/32.png) [@QuasiG](https://discuss.gradle.org/u/QuasiG)\
**Post date:** [March 26, 2024, 12:00pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/13 "2024-03-26T12:00:23Z")

</div>

Ah ok, thanks very much for pointing me in the right direction regarding javafx; I will look into that.

My base question about the syntax for using classifiers with bundles still stands though as I have a couple of other examples with our own jars where we have the same problem.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [March 27, 2024, 1:59am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/14 "2024-03-27T01:59:13Z")

</div>

You cannot set “the classifier of a bundle”, as a bundle cannot have a classifier.  
If you want a classifier on all childs of the bundle, you have to iterate the bundle, for example like:

```kts
dependencies {
    libs.bundles.foo.get().forEach {
        implementation(it) {
            artifact {
                classifier = "bar"
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![QuasiG](https://avatars.discourse-cdn.com/v4/letter/q/ed8c4c/32.png) [@QuasiG](https://discuss.gradle.org/u/QuasiG)\
**Post date:** [March 27, 2024, 9:41am UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/15 "2024-03-27T09:41:34Z")

</div>

Thank you.  
I envisaged this would have been the “behind the scenes” implementation of setting a classifier on a bundle. Thanks very much for your help.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [March 27, 2024, 1:38pm UTC](https://discuss.gradle.org/t/gradle-version-catalog-and-javafx-dependencies-classifier/40826/16 "2024-03-27T13:38:11Z")

</div>

Feel free to open a feature request or pull request, maybe the Gradle folks like it. 🤷‍♂️  
But actually, in most situations it is anyway better to use a component metadata rule to create proper variants you can then properly depend on instead of using classifiers. 🙂
