Building a fully executable Spring Boot 1.3 war from a Gradle multi project build - spring-boot

I'm trying to build a fully executable WAR using Spring Boot 1.3 as per https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html. If I build a single Gradle project, it all works fine, but I havea multi project build, where I have a "root" project and then several projects underneath it, and I cannot get it to build anything but a standard, "fat" WAR file, without the providedRuntime of Jetty and without the scripts to make it run.
Does anyone know how to do this?
In my root project, I have the following (abridged):
buildscript {
repositories {
mavenCentral()
}
ext {
springBootVersion = '1.3.0.RELEASE'
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
}
}
allprojects {
//Put instructions for all projects
repositories {
mavenCentral() // jcenter is missing spring-orm.4.1.6.RELEASE jar file so try mavenCentral first
jcenter {
url "http://jcenter.bintray.com/"
}
maven { url 'http://repo.opensourceagility.com/release' }
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'spring-boot'
}
and then in the subproject which is a web project, and which I'm trying to build, I have:
apply plugin: 'war'
dependencies {
// Include related projects
compile project(':project-model')
compile project(':project-dynamoDB')
// Core Spring Boot - note version is set in main build.gradle file
compile 'org.springframework.boot:spring-boot-starter-web'
// Remove Tomcat (included in -web) and include Jetty instead
providedRuntime 'org.springframework.boot:spring-boot-starter-jetty'
// Other Spring modules
compile 'org.springframework.boot:spring-boot-starter-social-facebook'
compile 'org.springframework.boot:spring-boot-starter-social-linkedin'
compile 'org.springframework.social:spring-social-google:1.0.0.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.springframework:spring-context'
compile 'org.springframework:spring-context-support'
}
configurations {
providedRuntime.exclude group: 'org.springframework.boot', module:'spring-boot-starter-tomcat'
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' // exclude when using log4j
}
springBoot {
mainClass = 'rs.web.Weblication'
executable = true
}
bootRun {
addResources = true
}
processResources {
// exclude resources if they look like they're profile dependent but don't match the current env/profile
eachFile { d ->
if(d.name.endsWith('.xml') || d.name.endsWith('.yaml') || d.name.endsWith('.properties')) {
//def fname = d.name.replaceFirst(~/\.[^\.]+$/, '')
//if(fname.indexOf("-") > -1 && ! fname.endsWith("-" + environment)) {
// d.exclude()
//} else {
// replace #variables# listed below in properties/config files
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
activeProfiles: environment
])
//}
}
}
}
war {
baseName = 'project-web'
version = '1.0.0'
manifest {
attributes 'Implementation-Title': baseName,
'Implementation-Version': version
}
webXml = file('src/main/resources/web.xml')
// rename the war task which has profiles appended from warName-profile,profile2.war
// to warName-profile.profile2.war
classifier = environment.replaceAll(',','-')
}
but when I build it (./gradlew build, or ./gradlew subprojectname:build), all is well and a working WAR is created, but not an executable one.
With a single project, I have it working fine.

Ah ha, right well I build a test multi-project build and it worked OK, so it was clearly the configuration above.
I worked through a process of elimination and it turns out that the problematic area was the line
classifier = environment.replaceAll(',','-')
which is intended to rename files with environment variables as part of the name. This process seems to get in the way of the script addition; perhaps it could be applied afterwards if it's really necessary.

Related

How to run grails integration tests with gradle

Old internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "2.4.4"
}
apply plugin: "grails"
grails {
grailsVersion = "2.4.4"
springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
// Grails plugins
compile "org.grails.plugins:hibernate4:4.3.6.1"
compile "org.grails.plugins:tomcat:7.0.55"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
test "org.grails:grails-test:$grailsVersion"
test "org.grails:grails-plugin-testing:$grailsVersion"
test 'org.hamcrest:hamcrest-all:1.1'
test 'org.mockito:mockito-all:1.8.0'
test 'nekohtml:nekohtml:1.9.6.2'
bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmOptions.jvmArgs '-XX:MaxMetaspaceSize=256m'
jvmOptions.systemProperty('XXXX.conf.file', "$configOutputDir/XXXX_test.properties")
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
'grails-run-app' {
dependsOn(':configProperties', ':dbValidate')
jvmOptions.jvmArgs '-XX:MaxMetaspaceSize=256m'
jvmOptions.systemProperty('XXXX.conf.file', "$configOutputDir/XXXX_dev.properties")
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.outputFile) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven {
url "http://nexus.XXXXX.com/content/groups/public/"
}
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.1.2"
}
}
New internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "3.3.3"
}
apply plugin: "org.grails.grails-web"
apply plugin: "war"
apply plugin:"org.grails.grails-gsp"
grails {
grailsVersion = "3.3.3"
//springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
//test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
compile "org.grails:grails-plugin-validation:3.3.3"
compile 'org.grails.plugins:converters:4.0.0'
compile 'org.grails.plugins:gorm-tools:6.1.11-v.12'
compile "org.grails:grails-plugin-databinding"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-core"
// Grails plugins
compile "org.grails.plugins:hibernate4:4.3.6.1"
compile "org.grails.plugins:tomcat:7.0.55"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
//test "org.grails:grails-test:$grailsVersion"
// test "org.grails:grails-plugin-testing:$grailsVersion"
// test 'org.hamcrest:hamcrest-all:1.1'
//test 'org.mockito:mockito-all:1.8.0'
// test 'nekohtml:nekohtml:1.9.6.2'
// bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_test.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
bootRun {
dependsOn(':configProperties', ':dbValidate')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_dev.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
//systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.archivePath) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://dl.bintray.com/jfrog/jfrog-jars/" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
//maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repo.maven.apache.org/maven2/" }
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:3.3.3"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
classpath "org.gradle:gradle-tooling-api:5.+"
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
//classpath "org.grails.plugins:hibernate4:${gormVersion-".RELEASE"}"
}
}
I had to upgrade gradle from 2.2 to 3.5. One of the gradle modules I have is a grails app called internal-tools. I posted the old build.gradle we used and the new one I am still working on. I had to change some of it around after upgrading gradle to 3.5.
The old internal-tools.gradle used to start up the application and run through a series of integration tests. My new internal-tools.gradle is not starting up the application and running through the integration tests. I was wondering if anyone had any ideas or ran into the same problem upgrading gradle and grails. I inherited this project so I'm not 100% sure what these gradle files are doing.
If the 'grails-run-app' task is what started it up in the old gradle file what is the equivalent I can use in gradle 3.5? I tried putting the same things in a "bootRun" task but that doesn't seem to work. It could be related to an issue I was having where the app thought it was spring boot so I had to stick a public static void main in there so the ":internal-tools:findMainClass" would work.
Actually the more I look at it I think the grails-run-app was just used to start up the application after it was built. So I'm not sure what started up the application and ran the integration tests in the old gradle file, and how I can reproduce the same thing with gradle 3.5

Gradle Kotlin Native - You have not specified any compilation arguments. No output has been produced

I'm pretty new to Gradle and Kotlin Native. I want to setup my build.gradle so that I can use Native to compile my code. I'm using the Konan plugin to do this. It worked fine when I hard-coded my class in the konanArtifacts.program.srcFiles. But obviously if I add more classes, I'll have to add the paths to srcFiles and I don't (and shouldn't) need to. So I looked around to find a way to add any classes I add automatically, and I attempted sourceSets. But when I try to run the compileKonanClientMingw task now my gradle console gives me the following:
error: you have not specified any compilation arguments. No output has been produced.
I'm not entirely sure that I'm using sourceSets correctly, but this seems to be the farthest I got. Below is my build.gradle
build.gradle:
buildscript {
ext.kotlin_version = '1.2.41'
ext.konan_version = '0.6'
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konan_version"
}
}
plugins {
id 'java'
}
group 'net.dev909'
version '1.0'
apply plugin: 'kotlin'
apply plugin: 'konan'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
sourceSets.main.allSource.srcDir '/src/main/kotlin/'
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
konanArtifacts {
program('client-' + version) {
srcFiles sourceSets.main.runtimeClasspath
}
}
Source sets are a part of the Java world and the Java plugin, so the Kotlin/Native plugin avoids using them to be independent on Java. But you still able to compile a bunch of classes, just specify the srcDir parameter:
konanArtifacts {
program('client-' + version) {
srcDir 'src/main/kotlin/'
}
}
Also note that src/main/kotlin/ is a default source path. So if you use only this path, you don't need to specify it explicitly. You may just write:
konanArtifacts {
program('client-' + version)
}

Use Gradle to generate Java classes from a Swagger definition into a standalone JAR

I am fairly new to both Gradle and Swagger code generator plugin for it (concretely the one that is linked from Swagger's website, i.e. https://github.com/thebignet/swagger-codegen-gradle-plugin), so I'm not sure whether my problem is with Gradle in general or with that particular plugin.
I've created a simple multi-module Spring Boot application (but the fact that I'm using Spring Boot or even Spring doesn't matter much). It's a console application; i.e. it doesn't start a webserver. In fact, it's actually a REST client consuming someone else's interface.
The application consists of four modules: spc-parent (which is just an envelope for the rest) containing spc-boot, spc-service, and spc-integration-model. Spc-boot contains just the starting point of the application, spc-service now contains a single Spring service, and spc-integration-model is meant to contain classes needed to consume the REST interface. The resulting structure will be much more complicated but I've tried to create a sort of a minimal example.
The problem lies within the spc-integration-model module. It consists of a single source file, petstore.json, and a build.gradle copied from https://github.com/thebignet/swagger-codegen-gradle-plugin (and only slightly modified). There are actually two problems (but they may have the same underlying cause).
When running gradle build (from spc-parent) for the very first time, it fails. Java sources are generated from petstore.json but they don't get compiled, which is why the service in spc-service doesn't see needed classes. However, running gradle build a second time fixes this (generated Java sources get compiled which makes it possible to compile spc-service, too).
The created JAR of spc-integration-model never contains anything besides Manifest.
My goal here is to persuade Gradle to compile the generated classes right away during the first build and also to put them into the JAR.
Now for some concrete Gradle tasks. The most interesting is spc-integration-model's build.gradle:
plugins {
id 'org.detoeuf.swagger-codegen' version '1.7.4'
id 'java'
}
apply plugin: 'org.detoeuf.swagger-codegen'
repositories {
mavenCentral()
jcenter()
}
swagger {
inputSpec = 'http://petstore.swagger.io/v2/swagger.json'
outputDir = file('build/swagger')
lang = 'java'
additionalProperties = [
'apiPackage' : 'ondra.spc.integration.client.api',
'dateLibrary' : 'java8',
'hideGenerationTimestamp': 'true',
'invokerPackage' : 'ondra.spc.integration.client',
'library' : 'resttemplate',
'modelNameSuffix' : 'Dto',
'modelPackage' : 'ondra.spc.integration.client.model'
]
importMappings = [
'Dog': 'io.swagger.petstore.client.model.Dog'
]
}
sourceSets {
swagger {
java {
srcDir file("${project.buildDir.path}/swagger/src/main/java")
}
}
}
classes.dependsOn('swagger')
ext {
spring_boot_version = springBootVersion
jackson_version = jacksonVersion
junit_version = jUnitVersion
swagger_annotations_version = swaggerAnnotationsVersion
swagger_codegen_version = swaggerCodegenVersion
}
dependencies {
swaggerCompile "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
swaggerCompile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile sourceSets.swagger.output
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "io.swagger:swagger-codegen:$swagger_codegen_version"
testCompile "junit:junit:$junit_version"
}
(Now that I'm re-reading my question I see that the local version of petstore.json is actually not used and an online version is used instead but let's leave that aside.)
The rest should be quite straightforward. spc-service:
dependencies {
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-web:$springVersion"
compile project (":spc-integration-model")
}
spc-boot:
dependencies {
compile "org.springframework.boot:spring-boot:$springBootVersion"
compile "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
compile "org.springframework:spring-web:$springVersion"
runtime "org.hibernate.validator:hibernate-validator:$hibernateVersion"
runtime "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile project (":spc-service")
testCompile("org.junit.jupiter:junit-jupiter-api:$jUnitVersion")
testRuntime("org.junit.jupiter:junit-jupiter-engine:$jUnitVersion")
}
test {
useJUnitPlatform()
}
spc-parent:
subprojects {
apply plugin: 'java'
group 'ondra'
version '1.0-SNAPSHOT'
buildscript {
ext {
hibernateVersion = '6.0.9.Final'
jacksonVersion = '2.9.4'
springBootVersion = '2.0.0.RELEASE'
springVersion = '5.0.5.RELEASE'
swaggerAnnotationsVersion = '1.5.16'
swaggerCodegenVersion = '2.2.3'
jUnitVersion = '5.1.1'
}
repositories {
mavenCentral()
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
}
And spc-parent's settings.gradle:
rootProject.name = 'spc-parent'
include 'spc-boot'
include 'spc-service'
include 'spc-integration-model'
I've also put the whole application into a single archive: https://drive.google.com/open?id=1cOYIcaxnhik548w0wEGswgD2g4udATdD

Kotlin Quasar example not working

I am testing the Kotlin Quasar actor example.
Quasar and Kotlin – a Powerful Match
So the question is, is this example out of date and is there any documentation in which I can find out how to use Kotlin and Quasar?
This is my gradle.build file.
group 'no.inmeta.kotlin.akka'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "co.paralleluniverse:quasar-kotlin:0.7.4"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}
I'm part of the Quasar team.
The post cites Quasar tests which you can run by cloning the Quasar repo and running e.g. gradle :quasar-kotlin:build (requires Gradle installed) but for new projects/experiments I suggest to start instead from the Gradle template, kotlin branch which now uses the latest Kotlin 1.0.1-2 (and for simplicity the latest Quasar 0.7.5-SNAPSHOT that depends on it).
Starting from that template I built this project (more info about how to configure it and run it in the main README) that runs the same Quasar actor tests as normal programs rather than tests. Here's its build.gradle:
group 'no.inmeta.kotlin.akka'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlinVer = '1.0.1-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVer"
}
}
apply plugin: 'kotlin'
apply plugin: 'application'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceCompatibility = 1.8 // 1.7
targetCompatibility = 1.8 // 1.7
configurations {
quasar
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
}
repositories {
// mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/releases" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
// maven { url 'https://maven.java.net/content/repositories/snapshots' }
}
ext.classifier = ':jdk8' // ':'
ext.quasarVer = '0.7.5-SNAPSHOT'
dependencies {
compile "co.paralleluniverse:quasar-core:${quasarVer}${classifier}"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVer"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVer"
compile "co.paralleluniverse:quasar-kotlin:${quasarVer}"
quasar "co.paralleluniverse:quasar-core:${quasarVer}${classifier}#jar"
}
applicationDefaultJvmArgs = [
"-Dco.paralleluniverse.fibers.verifyInstrumentation=true",
"-Dco.paralleluniverse.fibers.detectRunawayFibers=false",
"-javaagent:${configurations.quasar.singleFile}" // =v, =d
]
// mainClassName = 'co.paralleluniverse.kotlin.actors1.PingPongKt'
mainClassName = 'co.paralleluniverse.kotlin.actors2.PingPongWithDeferKt'
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
defaultTasks 'run'
Some notes about the differences with your build file:
Since I converted the tests to programs, I'm including the application plugin and its configuration (here, applicationDefaultJvmArgs and mainClassName) as well as setting the default Gradle task to run.
In addition to the above, a gradle wrapper has been generated and pushed so that ./gradlew is all you need on the command line, with no need to have a local Gradle installation (how to run it in an IDE depends on the IDE).
You need to run the Quasar agent (or AoT instrumentation but using the agent here) so there's a quasar configuration pointing to the artifact that is then used to pass the -javaagent:${configurations.quasar.singleFile} JVM argument.
Using Java 8 as Quasar has a specific optimized build for it.
Also note that there is now a 1.0 branch of the quasar-kotlin-jetbrains-webinar project (which is now the HEAD one in fact), which contains the companion source code of this guest webinar with IntelliJ, ported to the latest Kotlin and Quasar as well.
Let me know if this helps.

Gradle fails to create Eclipse project files

I am trying to start a new Java EE project with Gradle. I have everything close to the way I want it, and im trying to build the eclipse files. The problem is when i run the command gradle eclipse the eclipse plugin creates the eclipse files for the bottom level project, but not the subprojects.
my folders look like this
foobar
--ear
--ejb
--spring
--web
build.gradle
settings.gradle
even if i do gradle ejb:eclipse everything appears to run correctly, i get the notices that the eclipse tasks ran in the console, but no files in the ejb project.
here is my build.gradle. What am i doing wrong?
configure(allprojects){ project ->
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = 1.6
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: "C:/IBM/WebSphere/AppServer/8.5/plugins/", include: [
'com.ibm.ws.runtime.jar',
'com.ibm.ws.wsadie/marshall.jar'
])
compile fileTree(dir: "C:/IBM/WebSphere/AppServer/8.5/runtimes/", include: [
'com.ibm.jaxrs.thinclient_8.5.0.jar',
'com.ibm.jaxws.thinclient_8.5.0.jar',
'com.ibm.ws.ejb.embeddableContainer_8.5.0.jar',
'com.ibm.ws.ejb.thinclient_8.5.0.jar',
'com.ibm.ws.jpa.thinclient_8.5.0.jar',
'com.ibm.ws.orb_8.5.0.jar'
])
}
ext {
easymockVersion = '3.3.1'
jeeVersion = '6.0'
junitVersion = '4.12'
springVersion = '4.1.5.RELEASE'
swaggerVersion = '1.3.12'
}
}
project('ear'){
description = "The EAR Project"
apply plugin: 'ear'
dependencies {
deploy project(':ejb')
deploy project(':spring')
deploy project(path: ':web', configuration: 'archives')
}
}
project('ejb'){
description = "The EJB Project"
dependencies {
compile project(':spring')
}
}
project('spring'){
description = "The Spring BL Logic"
dependencies {
runtime "org.springframework:spring-jdbc:$springVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.easymock:easymock:$easymockVersion"
testCompile "org.springframework:spring-test:$springVersion"
}
}
project('web'){
description = "The REST layer"
apply plugin: 'war'
dependencies {
compile project(':ejb')
runtime "com.wordnik:swagger-annotations:$swaggerVersion"
runtime "com.wordnik:swagger-core_2.10:$swaggerVersion"
runtime "com.wordnik:swagger-jaxrs_2.10:$swaggerVersion"
}
}
This is the output i get. It tells me the plugin fired for the subprojects but i can't figure out why it doesn't create any files
$ gradle eclipse
:eclipseClasspath
:eclipseJdt
:eclipseProject
:eclipse
:ear:eclipseClasspath
:ear:eclipseJdt
:ear:eclipseProject
:ear:eclipse
:ejb:eclipseClasspath
:ejb:eclipseJdt
:ejb:eclipseProject
:ejb:eclipse
:spring:eclipseClasspath
:spring:eclipseJdt
:spring:eclipseProject
:spring:eclipse
:web:eclipseClasspath
:web:eclipseJdt
:web:eclipseProject
:web:eclipse

Resources