我试图将SpringLoaded添加到使用gradle的项目中,但热插拔不起作用。这是build.gradle
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'application'
//plugins
//{
// id 'fi.jasoft.plugin.vaadin' // version '0.11.0-beta'
//}
ext
{
mainClass = 'net.elenx.Epomis'
springBoot = '1.4.1.BUILD-SNAPSHOT'
springLoaded = '1.2.7.BUILD-SNAPSHOT'
vaadin = '7.6.8'
}
configurations
{
springLoadedPath
}
dependencies /** APACHE LICENCE v2.0 **/
{
/** SPRING **/
springLoadedPath "org.springframework:springloaded:${springLoaded}"
compile configurations.springLoadedPath
compile "javax.inject:javax.inject:+"
compile "org.springframework.boot:spring-boot-starter-mail:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-web:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-jetty:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-test:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-social-facebook:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-social-linkedin:${springBoot}"
compile "org.springframework.boot:spring-boot-starter-thymeleaf:${springBoot}"
compile "org.springframework.boot:spring-boot-configuration-processor:${springBoot}"
/** DATABASE **/
compile "commons-dbcp:commons-dbcp:+"
compile "org.springframework.data:spring-data-jpa:1.10.2.RELEASE"
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBoot}"
/** UTILS **/
compile "commons-io:commons-io:+"
compile "commons-net:commons-net:+"
compile "com.google.code.gson:gson:+"
compile "com.google.guava:guava:+"
compile "org.apache.commons:commons-lang3:+"
compile "com.fasterxml.jackson.core:jackson-core:+"
compile "javax.mail:mail:+"
compile "org.slf4j:slf4j-api:+"
compile 'com.twilio.sdk:twilio-java-sdk:+'
/** ASPECTS **/
compile "org.springframework:spring-aop:+"
compile "org.springframework.boot:spring-boot-starter-aop:+"
compile "cglib:cglib:+"
compile "cglib:cglib-nodep:+"
/** FRONTEND **/
compile "com.vaadin:vaadin-spring-boot-starter:+"
compile "com.vaadin:vaadin-themes:${vaadin}"
compile "com.vaadin:vaadin-client:${vaadin}"
compile "com.vaadin:vaadin-push:${vaadin}"
compile "com.vaadin:vaadin-server:${vaadin}"
compile "com.vaadin:vaadin-client-compiled:${vaadin}"
compile "com.vaadin:vaadin-spring:+"
compile "com.vaadin.tapio:googlemaps:+"
/** TESTS **/
testCompile "org.codehaus.groovy:groovy-all:+"
testCompile "org.spockframework:spock-core:+"
testCompile "org.objenesis:objenesis:+"
testCompile "org.spockframework:spock-spring:+"
}
dependencies /** LGPL v2.1 LICENCE **/
{
/** DATABASE **/
compile "org.hibernate:hibernate-core:+"
compile "org.hibernate:hibernate-entitymanager:+"
compile "org.hibernate:hibernate-validator:+"
}
dependencies /** MIT LICENCE **/
{
/** UTILS **/
compile "org.projectlombok:lombok:+"
compile "org.jsoup:jsoup:+"
}
dependencies /** ECLIPSE PUBLIC LICENCE **/
{
/** ASPECTS **/
compile "org.aspectj:aspectjrt:+"
compile "org.aspectj:aspectjweaver:+"
}
dependencies /** BSD LICENCE **/
{
/** DATABASE **/
compile "org.hsqldb:hsqldb:+"
/** ASPECT **/
compile "com.jcabi:jcabi-aspects:+"
/** TESTS **/
testCompile "org.hamcrest:hamcrest-core:+"
}
dependencies /** POSTGRESQL (MIT/BSD LIKE) LICENCE **/
{
/** DATABASE **/
compile "org.postgresql:postgresql:+"
}
configurations
{
compile.exclude module: 'spring-boot-starter-tomcat'
}
String epomisVersion = 'v1'
group 'net.elenx'
version epomisVersion
jar
{
baseName = 'Epomis'
version = epomisVersion
}
buildscript
{
repositories
{
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/snapshot-libs' }
}
dependencies
{
classpath 'org.springframework.boot:spring-boot-gradle-plugin:+'
classpath 'org.springframework:springloaded:+'
}
}
repositories
{
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/snapshot-libs' }
maven { url 'http://maven.vaadin.com/vaadin-addons' }
}
mainClassName = mainClass
applicationDefaultJvmArgs = ["-javaagent:${configurations.springLoadedPath.asPath}", '-noverify']
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.8'
}
}
compileJava
{
options.fork = true
options.incremental = true
}
idea
{
module
{
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
war
{
archiveName = 'ROOT.war'
destinationDir = file('webapps')
}
task stage \
{
dependsOn build
}
我还在文件中添加了vm选项-javaagent:PathToFile -noverify
,checked Make project automatically
- >设置 - >构建,执行,部署 - >编译器并在注册表中检查compiler.automake.allow.when.app.running
但热交换仍然不起作用,我现在不知道原因。