Skip to content

Commit

Permalink
Quickstart gradle fixes (#2214)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
barchetta authored Jul 29, 2020
1 parent b19f866 commit 0b261b1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
34 changes: 28 additions & 6 deletions examples/quickstarts/helidon-quickstart-mp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'

testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

testCompileOnly 'org.junit.jupiter:junit-jupiter-api'
test {
useJUnitPlatform()
}

// define a custom task to copy all dependencies in the runtime classpath
Expand All @@ -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

13 changes: 10 additions & 3 deletions examples/quickstarts/helidon-quickstart-se/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,28 @@ ext {
helidonversion = '2.0.2-SNAPSHOT'
}

test {
useJUnitPlatform()
}

repositories {
mavenCentral()
mavenLocal()
}

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
Expand Down

0 comments on commit 0b261b1

Please sign in to comment.