Gradle - Could not find org.faces:primefaces-12.0.4-jakarta:

Originally using: Gradle with Groovy it builds & deploys my EAR, JAR & WAR:

lib/bootstrap-1.0.10.jar
lib/primefaces-12.0.4-jakarta.jar

WEB-INF/lib/bootstrap-1.0.10.jar
WEB-INF/lib/primefaces-12.0.4-jakarta.jar

Migratied to Gradle with Kotlin :

./gradlew build clean --scan 

> Configure project :
WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.8.10` that might work differently than in the requested version `1.8.21`.
>>>>> 2 deleteFiles
>>>>> 3 NOTiFYmotoWAR
>>>>> 4 NOTiFYmotoJAR
>>>>> 5 copyNOTiFYmotoWAR
>>>>> 6 copyNOTiFYmotoJAR
>>>>> 7 NOTiFYmotoEAR

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.faces:primefaces-12.0.4-jakarta:.
     Searched in the following locations:
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/compile/primefaces-12.0.4-jakarta.jar
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/provided/primefaces-12.0.4-jakarta.jar
     Required by:
         project :
   > Could not find org.primefaces.themes:bootstrap:1.0.10.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/primefaces/themes/bootstrap/1.0.10/bootstrap-1.0.10.pom
       - https://dl.google.com/dl/android/maven2/org/primefaces/themes/bootstrap/1.0.10/bootstrap-1.0.10.pom
       - https://plugins.gradle.org/m2/org/primefaces/themes/bootstrap/1.0.10/bootstrap-1.0.10.pom
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/compile/bootstrap-1.0.10.jar
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/compile/bootstrap.jar
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/provided/bootstrap-1.0.10.jar
       - file:/Users/NOTiFY/IdeaProjects/NOTiFYmoto/libs/provided/bootstrap.jar
     Required by:
         project :

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

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

BUILD FAILED in 1s
1 actionable task: 1 executed

Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no] yes

Gradle Terms of Service accepted.

Publishing build scan...
Publishing build scan failed due to network error 'java.net.SocketException: Unexpected end of file from server' (2 retries remaining)...
Publishing build scan failed due to network error 'java.net.SocketException: Unexpected end of file from server' (1 retry remaining)...

A network error occurred.

If you require assistance with this problem, please report it via https://gradle.com/help/plugin and include the following information via copy/paste.

----------
Gradle version: 8.1.1
Plugin version: 3.12.6
Request URL: https://status.gradle.com
Request ID: 309d78b7-9e8c-4598-8e51-1b7e49d78339
Exception: java.net.SocketException: Unexpected end of file from server
----------
PF 12.0.4-Jakarta. Jakarta Faces 4.0.1.
Mojarra 4.0.0.SP01. OmniFaces 4.1
WildFly 28.0.0.Final 'preview' Jakarta EE 10.0.0
JDK 20, Kotlin 1.8.21, Gradle 8.1.1 Kotlin, MongoDB 6.0.6
IntelliJ IDEA 2023.1.2, macOS Ventura 13.4

Can find the JAR for:

bootstrap-1.0.10.jar
primefaces-12.0.4-jakarta.jar

Is there a question hidden somewhere?
You are depending on two libraries that are not found.
From the output I’d guess you check in your libraries together with your sources but do not have included those versions in there.
Look in your libs/compile/ and libs/provided/ folders.

Migrated:

flatDir {
    dirs("libs/compile")
    dirs("libs/provided")
}

to:

flatDir {
    dirs("lib")
}

could someone give me pointers to a solution. I am trying to get PrimeFaces 14-RC1 with jakarta as the classifier. Is not working if i do

dependencies {
implementation("org.primefaces:primefaces:14.0.0-RC1-jakarta")
}

Maven dependency that works

<!-- Jakarta EE / jakarta.* / Faces 3.0 - Faces 4.0  -->
<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>14.0.0-RC1</version>
    <classifier>jakarta</classifier>
</dependency>

I see in the maven POM that there is some shadow classifier for jakarta https://repo.maven.apache.org/maven2/org/primefaces/primefaces/14.0.0-RC1/primefaces-14.0.0-RC1.pom

I downloaded:

primefaces-14.0.0-RC1-jakarta

from:

https://repo1.maven.org/maven2/org/primefaces/primefaces/14.0.0-RC1/

Changed ‘Gradle’ to:

dependencies {
    ...
    implementation("org.faces:primefaces-14.0.0-RC1-jakarta")
    ---
}

Deployed the ‘primefaces-14.0.0-RC1-jakarta’ JAR on:

WEB-INF/lib/primefaces-14.0.0-RC1-jakarta.jar
&
lib/primefaces-14.0.0-RC1-jakarta.jar

Built with Gradle 8.21 with WAR + JAR = EAR. Deployed EAR on ‘WildFly 31.0.0.Final’ and runs:

INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 89) Running on PrimeFaces 14.0.0-RC1

Not sure you mean with “some shadow classifier for jakarta”. My gradle also has:

compileOnly("jakarta.platform:jakarta.jakartaee-api:10.0.0")
implementation("jakarta.platform:jakarta.jakartaee-web-api:10.0.0")
providedCompile("jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1")

Your questions actually has only slightly to do with the thread here which is about dependencies that are checked in alongside the source code.

To depend on a classified artifact, you would use :classifier not -classifier, so in your case for example

implementation("org.primefaces:primefaces:14.0.0-RC1:jakarta")

But be aware, that you then say “I want only that classified artifact” and you would not get the dependencies.

To get the classified artifact and the dependencies, optimally PrimeFaces would publish Gradle Module Metadata with two feature variants, one for non-jakarta, one for jakarta. Then you could request that you want the jakarta variant and would also get the necessary dependencies approperiately.

So to fix it properly like documented at Fixing metadata with component metadata rules you would do something like

dependencies {
    components {
        withModule("org.primefaces:primefaces") {
            addVariant("compileJakarta", "compile") {
                withCapabilities {
                    removeCapability(id.group, id.name)
                    addCapability(id.group, "${id.name}-jakarta", id.version)
                }
                withFiles {
                    removeAllFiles()
                    addFile("${id.name}-${id.version}-jakarta.jar")
                }
            }
            addVariant("runtimeJakarta", "runtime") {
                withCapabilities {
                    removeCapability(id.group, id.name)
                    addCapability(id.group, "${id.name}-jakarta", id.version)
                }
                withFiles {
                    removeAllFiles()
                    addFile("${id.name}-${id.version}-jakarta.jar")
                }
            }
        }
    }
    implementation("org.primefaces:primefaces:14.0.0-RC1") {
        capabilities {
            requireCapability("org.primefaces:primefaces-jakarta")
        }
    }
}

In the current version of PrimeFaces all dependencies are in the provided scope anyway, so actually just requesting the classified artifact would work the same, as no transitive dependencies are involved.