spring - Intellij + Gradle + SpringLoaded + Tomcat -
i'm developing spring rest service using gradle, intellij, , tomcat. want reload changes without redeploying, use springloaded. doesn't reload project. hot swap doesn't work. here build.gradle:
def group = 'com.expecker' version '1.0-snapshot' apply plugin: 'java' apply plugin: 'war' apply plugin: 'maven' sourcecompatibility = 1.8 targetcompatibility = 1.8 def springversion = '4.0.0.release' def hibernateversion = '5.0.7.final' def junitversion = '4.11' repositories { mavencentral() } dependencies { testcompile group: 'junit', name: 'junit', version: junitversion compile "org.springframework:spring-core:$springversion" compile "org.springframework:spring-web:$springversion" compile "org.springframework:spring-webmvc:$springversion" compile "org.springframework:spring-orm:$springversion" compile "org.springframework:spring-jdbc:$springversion" compile "org.springframework:spring-tx:$springversion" compile "org.springframework:spring-orm:$springversion" compile "org.springframework:spring-context:$springversion" compile 'javax.servlet:javax.servlet-api:3.1.0' compile 'jstl:jstl:1.2' compile 'javax.servlet.jsp:jsp-api:2.2' // compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13' seems library isn't compatible spring 4.1.x compile 'com.fasterxml.jackson.core:jackson-databind:2.6.4' compile "org.hibernate:hibernate-core:$hibernateversion" compile "org.hibernate:hibernate-entitymanager:$hibernateversion" compile 'commons-dbcp:commons-dbcp:1.4' //compile('org.springframework:springloaded:1.2.5.release') } buildscript { repositories { jcenter() } dependencies { classpath 'org.springframework:springloaded:1.2.5.release' } } apply plugin: 'idea' idea { module { inheritoutputdirs = false outputdir = file("$builddir/classes/main/") } } /* when built in openshift 'openshift' profile used when invoking mvn. use profile openshift specific customization app need. default put resulting archive 'webapps' folder. http://maven.apache.org/guides/mini/guide-building-for-different-environments.html */ gradle.buildfinished { buildresult -> println 'building pom.xml...' pom { project { groupid "${group}" artifactid 'app' version "${version}" packaging 'war' }.withxml { asnode().appendnode('profiles'). appendnode('profile').with { appendnode('id', 'openshift') appendnode('build').with { appendnode('finalname', 'expecker') appendnode('plugins').appendnode('plugin').with { appendnode('artifactid', 'maven-war-plugin') appendnode('version', '2.1.1') appendnode('configuration').with { appendnode('outputdirectory', 'deployments') appendnode('warname', 'expecker') } } } } } }.writeto("pom.xml")} in tomcat configuration have vm option -javaagent:|here path springloaded.jar| -noverify. chose exploded artifact on deployment tab.
as can see, tried include springloaded jar classpath (i don't know why it's needed, saw in articles). tried add jar compile dependency, can't build project. tried not include it, set in vm options. here observations:
- simple hot swap doesn't work springloaded agent, works without it
- it looks tomcat use \out\artifacts\expecker\exploded\expecker-1.0-snapshot.war\ folder, when make project, changes reflected \build\ folder.
could me?
my fault, spring loaded doesn't support adding of new classes. so, actually, works expected.
Comments
Post a Comment