You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The value of main class is wrong, it should be io.helidon.microprofile.cdi.Main.
Dependencies are wrong, javax.activation -> jakarta.activation
enforcedPlatform() must be used instead of platform() otherwise some dependencies will be upgraded and that causes trouble.
It looks like org.glassfish.hk2.external:jakarta.inject:2.6.1 causes trouble as it provides duplicate classes. This dependency must be excluded.
It might be a good idea to configure the Gradle enforcer plugin to detect this case. Add the BanDuplicateClasses enforcer rule to the Helidon build (Maven) to detect duplicate classes.
The following Gradle build provides fixes for the aforementioned issues and could be used a starting point
plugins {
id 'com.github.johnrengelman.shadow'
id 'java'
id 'org.kordamp.gradle.jandex'
}
repositories {
jcenter()
}
dependencies {
implementation enforcedPlatform("io.helidon:helidon-dependencies:${helidonVersion}")
implementation('io.helidon.microprofile.bundles:helidon-microprofile') {
exclude group: 'org.glassfish.hk2.external', module: 'jakarta.inject'
}
runtimeOnly 'org.jboss:jandex'
runtimeOnly 'jakarta.activation:jakarta.activation-api'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
test {
useJUnitPlatform()
}
// define a custom task to copy all dependencies in the runtime classpath
// into build/libs/libs
// uses built-in Copy
task copyLibs(type: Copy) {
from configurations.runtimeClasspath
into 'build/libs/libs'
}
// add it as a dependency of built-in task 'assemble'
copyLibs.dependsOn jar
assemble.dependsOn copyLibs
// default jar configuration
// set the main classpath
// add each jar under build/libs/libs into the classpath
jar {
manifest {
attributes ('Main-Class': 'io.helidon.microprofile.cdi.Main',
'Class-Path': configurations.runtimeClasspath.files.collect { "libs/$it.name" }.join(' ')
)
}
}
Note that this build does not rely on the application plugin just yet (as shown in #2186 for Helidon SE). Packaging and running an application can be done by invoking
Since the PR fixed the most serious of the issues listed here I'm going to close this and use issue #2219 to track additional improvements to the quickstart example gradle files.
Environment Details
Problem Description
The Gradle Quickstart from Helidon MP 2.0.1 is missing a few things
io.helidon.microprofile.cdi.Main
.enforcedPlatform()
must be used instead ofplatform()
otherwise some dependencies will be upgraded and that causes trouble.org.glassfish.hk2.external:jakarta.inject:2.6.1
causes trouble as it provides duplicate classes. This dependency must be excluded.It might be a good idea to configure the Gradle enforcer plugin to detect this case. Add the BanDuplicateClasses enforcer rule to the Helidon build (Maven) to detect duplicate classes.
The following Gradle build provides fixes for the aforementioned issues and could be used a starting point
Note that this build does not rely on the
application
plugin just yet (as shown in #2186 for Helidon SE). Packaging and running an application can be done by invokingThe text was updated successfully, but these errors were encountered: