Quickstart gradle fixes (#2214)

* Update quickstart build.gradle files
* Change work-around for moving beans.xml for tests. Enable jandex
* Update gradle plugin org.kordamp.gradle.jandex to 0.6.0
This commit is contained in:
Joe DiPol
2020-07-29 08:26:58 -07:00
committed by GitHub
parent b19f866327
commit 0b261b1ce1
2 changed files with 38 additions and 9 deletions

View File

@@ -14,7 +14,10 @@
* limitations under the License.
*/
apply plugin: 'java'
plugins {
id 'java'
id 'org.kordamp.gradle.jandex' version '0.6.0'
}
group = 'io.helidon.examples'
version = '1.0-SNAPSHOT'
@@ -34,19 +37,24 @@ ext {
repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()
}
dependencies {
// import Helidon BOM
implementation platform("io.helidon:helidon-dependencies:${project.helidonversion}")
implementation enforcedPlatform("io.helidon:helidon-dependencies:${project.helidonversion}")
implementation 'io.helidon.microprofile.bundles:helidon-microprofile'
implementation 'org.glassfish.jersey.media:jersey-media-json-binding'
runtimeOnly 'org.jboss:jandex'
runtimeOnly 'javax.activation:javax.activation-api'
runtimeOnly 'jakarta.activation:jakarta.activation-api'
testCompileOnly 'org.junit.jupiter:junit-jupiter-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
@@ -67,8 +75,22 @@ assemble.dependsOn copyLibs
jar {
archiveFileName = "${project.name}.jar"
manifest {
attributes ('Main-Class': 'io.helidon.examples.quickstart.mp.Main',
attributes ('Main-Class': 'io.helidon.microprofile.cdi.Main',
'Class-Path': configurations.runtimeClasspath.files.collect { "libs/$it.name" }.join(' ')
)
}
}
// This is a work-around for running unit tests.
// Gradle places resource files under ${buildDir}/resources. In order for
// beans.xml to get picked up by CDI it must be co-located with the classes.
// So we move it before running tests.
// In either case it ends up AOK in the final jar artifact
task moveBeansXML {
doLast {
ant.move file: "${buildDir}/resources/main/META-INF/beans.xml",
todir: "${buildDir}/classes/java/main/META-INF"
}
}
test.dependsOn moveBeansXML

View File

@@ -31,6 +31,10 @@ ext {
helidonversion = '2.0.2-SNAPSHOT'
}
test {
useJUnitPlatform()
}
repositories {
mavenCentral()
mavenLocal()
@@ -38,14 +42,17 @@ repositories {
dependencies {
// import Helidon BOM
implementation platform("io.helidon:helidon-dependencies:${project.helidonversion}")
implementation 'io.helidon.bundles:helidon-bundles-webserver'
implementation enforcedPlatform("io.helidon:helidon-dependencies:${project.helidonversion}")
implementation 'io.helidon.webserver:helidon-webserver'
implementation 'io.helidon.media:helidon-media-jsonp'
implementation 'io.helidon.config:helidon-config-yaml'
implementation 'io.helidon.health:helidon-health'
implementation 'io.helidon.health:helidon-health-checks'
implementation 'io.helidon.metrics:helidon-metrics'
testCompileOnly 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'io.helidon.webclient:helidon-webclient'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
// define a custom task to copy all dependencies in the runtime classpath