Update Originally there was a Tomcat exception upon initialization of my gradle build's war file. After some help from the author, it is now deploying and running albiet partially. This may be due to a bug in Gradle. Editing with the updated build.gradle and SpringData Rest output at root of service below.
I have been attempting to compile and run a Spring Data Rest project originally written in Maven.. for Gradle instead.
Tutorial location : http://www.javacodegeeks.com/2013/08/spring-data-rest-in-action.html
My project builds fine, into a war via the following
*build.gradle *
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-milestone" }
mavenLocal()
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'war'
war {
baseName = 'whichdegree-service'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-milestone" }
maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:0.5.0.M5")
compile("org.springframework:spring-orm:4.0.0.M3")
compile("org.springframework.data:spring-data-jpa:1.3.2.RELEASE")
compile("org.springframework.data:spring-data-commons-core:1.3.2.RELEASE")
compile("org.hibernate:hibernate-entitymanager:4.2.1.Final")
//Added by author of tutorial
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.+'
//Spring-Data-REST, upgraded to 2.0.0 and Tomcat served war properly
compile("org.springframework.data:spring-data-rest-webmvc:2.0.0.M1")
//HSQL DB
compile("org.hsqldb:hsqldb:1.8.0.10")
testCompile("junit:junit:4.11")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
task copyDependencies(type: Copy) {
description = 'Copy dependencies to libs. Useful for Eclipse'
libDir = new File(project.projectDir, '/libs')
println libDir
println 'Adding dependencies from compile configuration'
for(file in configurations.compile) {
println 'Added ' + file
copy
{
from file
into libDir
}
}
}
Switching to 2.0 version of Spring Data REST fixed deployment, however the service doesn't seem to be active or working:
Expected Result of GET at service_root/
{
"links" : [ {
"rel" : "books",
"href" : "http://localhost:8080/books"
}, {
"rel" : "authors",
"href" : "http://localhost:8080/authors"
} ],
"content" : [ ]
}
Actual Result of GET at my service
{
"links" : [ ],
"content" : [ ]
}
Wondering if this is perhaps a bug in Gradle itself, not wiring Spring-Data-Rest properly..?