Integrating a Gradle Project with IBM Bluemix Dedicated

eclipse
plugins

(Kevin Schoen) #1

I am working with a back-end java/ front-end html/js/css application currently running on a windows 2008 server with Gradle(spring-boot) build. I am attempting to migrate this application to IBM’s Bluemix cloud service(dedicated). I have experience building an application using Maven with Bluemix using eclipse, however my project cannot be converted to a Maven project because of the dependencies already built into the code. If anyone has any experience using Gradle to build applications for Bluemix I would appreciate any help. Thanks.

This is my build.gradle file. Thanks for any help.

buildscript {
ext {
springBootVersion = ‘1.3.2.RELEASE’
}
repositories {
mavenCentral()
}
dependencies {
classpath(“org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}”)
}
}

apply plugin: 'java’
apply plugin: ‘eclipse’
//apply plugin: 'idea’
apply plugin: ‘spring-boot’
//apply plugin: ‘war’

jar {
baseName = 'tax-portal’
version = ‘1.1.0’
}

sourceSets {
main {
java {
srcDir ‘src/main/java’
}
resources {
srcDir 'src/main/resources’
srcDir ‘public’
}
output.resourcesDir = ‘build/static’
}
}

//war {
// baseName = ‘tax-portal’
//version = ‘1.0.0’
// from ‘public/’
// webXml = file(’./web.xml’)
//}

sourceCompatibility = 1.7
targetCompatibility = 1.7

repositories {
mavenCentral()
}

dependencies {

//compile files('C:/Program Files (x86)/IBM/Java60/lib/tools.jar')

compile files('C:/Users/H22673/db2_10 driver/db2jcc.jar')
compile files('C:/Users/H22673/db2_10 driver/db2jcc_license_cu.jar')
compile files('C:/Users/H22673/db2_10 driver/db2jcc4.jar')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile 'org.springframework.ldap:spring-ldap-core:2.0.4.RELEASE'
compile("org.springframework.security:spring-security-ldap:3.2.5.RELEASE")
//compile("org.springframework.security:spring-security-web:3.2.5.RELEASE")
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.data:spring-data-rest-hal-browser')
compile("org.springframework:spring-tx")

compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.4'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.4'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.7.4'



testCompile('org.springframework.boot:spring-boot-starter-test') 

//providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'

}

eclipse {
classpath {
containers.remove(‘org.eclipse.jdt.launching.JRE_CONTAINER’)
containers ‘org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7’
}
}

task wrapper(type: Wrapper) {
gradleVersion = ‘2.9’
}


(Lance Java) #2

No idea what bluemix is but if there are ant tasks you can easily invoke them using gradle’s ant integration


(James Justinic) #3

I have used Gradle to build applications for Bluemix. This was for public, not dedicated Bluemix, but whether the underlying hardware is shared or dedicated should not affect what you need to do.

However, it is unclear exactly what you want to integrate.

If you’re building a Spring Boot JAR, you should be able to run the exact same JAR on Bluemix as you do on the Windows 2008 server without doing anything different (unless you’re trying to introduce some IBM dependencies to lock yourself in). You just need to push your build with the appropriate buildpack to Bluemix (i.e. probably basic java, not Liberty).

If you’re instead trying create a Gradle task to handle the deployment to Bluemix, that’s a completely different question.


(Kevin Schoen) #4

Hi James thanks for the response.

I am trying to build a Spring Boot WAR file using Gradle that can be deployed to Bluemix. This is the basic process I’ve been following to try to accomplish this:

  1. I am using Eclipse Luna and importing the code as an existing project
  2. I build the project and attempt to run it on a Bluemix server and the code gets pushed successfully, but when I go to the URL I get a ‘Error 404: SRVE0190E: File not found: /’ message.
  3. when I look on my Bluemix dashboard, the app appears to be running, but i still cannot access the app through the URL.

Any advice or guidance would be extremely helpful.


(Kevin Schoen) #5

Thanks for the reply Lance

unfortunately the requirements of the project I’m working on doesn’t allow me to pursue this option. I appreciate the help.


(James Justinic) #6

I don’t really think that you have a Gradle problem. I am able to use the build.gradle you provided (minus the database dependencies) along with code from a standard Spring Boot Hello World example and I can access it as would be expected once deployed to Bluemix.

I think you’re dealing with either a Bluemix issue or a specifically a configuration in your application that isn’t compatible with the buildpack in Bluemix that you’re using. I don’t know that I can offer any other advice unless you can reproduce the same issue with a small sample project that you can share in its entirety. Even then, you might have much better luck with either Bluemix support or the Spring Boot community.