Hot deployment using jetty 8 and maven
I'm new to Maven, but would like to achieve a hot deployment while changing source code (Java). My environment: - Maven 3.2.1 - JDK: 1.6 - Jetty 8.1.14.v20131031 What I would like to achieve is: Everytime I change something in my servlets, Maven picks it up and recompiles these files (if possible only delta). Then, once it's done it should copy/move the *.class files into the directory of my webapp. This approach is needed to speed up my development cycle like I'm used to it from developing in Grails and GGTS. I'm starting up the application by running: *mvn clean install war:inplace jetty:run* And Here is what I have: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdcom.springapp/groupId artifactIdjetty-template/artifactId packagingwar/packaging version1.0-SNAPSHOT/version namejetty-template/name properties spring.version3.2.0.RELEASE/spring.version jetty.version2.2.3E/jetty.version /properties dependencies dependency groupIdorg.springframework/groupId artifactIdspring-core/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-web/artifactId version${spring.version}/version /dependency dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version /dependency dependency groupIdjavax.servlet.jsp/groupId artifactIdjsp-api/artifactId version2.1/version scopeprovided/scope /dependency dependency groupIdorg.springframework/groupId artifactIdspring-webmvc/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-test/artifactId version${spring.version}/version scopetest/scope /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.8.2/version scopetest/scope /dependency /dependencies build finalNamejetty-template/finalName outputDirectorytarget/classes/outputDirectory plugins plugin groupIdorg.mortbay.jetty/groupId artifactIdjetty-maven-plugin/artifactId version8.1.14.v20131031/version configuration scanIntervalSeconds1/scanIntervalSeconds classesDirectory${basedir}/src/main/webapp/WEB-INF/classes/classesDirectory webAppConfig allowDuplicateFragmentNamestrue/allowDuplicateFragmentNames /webAppConfig scanTargets scanTargetsrc/main/java/com/springapp/mvc/scanTarget scanTargetsrc/main/webapp/WEB-INF/scanTarget /scanTargets /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.4/version /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.1/version configuration source1.6/source target1.6/target /configuration /plugin /plugins /build /project I can see, that maven realizes that files in source folder (src) had been changed, but does not compile into the directory: */src/main/webapp/WEB-INF/classes* I would really appreciate any help. I'm struggling with this issue now for 2 days... :( -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
Hi Not really maven problem :-) Have a look at a product called jrebel or a free alt http://ssw.jku.at/dcevm/ I believe this mechanism will be part of the jdk soon/one day :-) -- Olivier On Apr 10, 2014 9:37 PM, Tom-Blank blank_...@rocketmail.com wrote: I'm new to Maven, but would like to achieve a hot deployment while changing source code (Java). My environment: - Maven 3.2.1 - JDK: 1.6 - Jetty 8.1.14.v20131031 What I would like to achieve is: Everytime I change something in my servlets, Maven picks it up and recompiles these files (if possible only delta). Then, once it's done it should copy/move the *.class files into the directory of my webapp. This approach is needed to speed up my development cycle like I'm used to it from developing in Grails and GGTS. I'm starting up the application by running: *mvn clean install war:inplace jetty:run* And Here is what I have: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdcom.springapp/groupId artifactIdjetty-template/artifactId packagingwar/packaging version1.0-SNAPSHOT/version namejetty-template/name properties spring.version3.2.0.RELEASE/spring.version jetty.version2.2.3E/jetty.version /properties dependencies dependency groupIdorg.springframework/groupId artifactIdspring-core/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-web/artifactId version${spring.version}/version /dependency dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version /dependency dependency groupIdjavax.servlet.jsp/groupId artifactIdjsp-api/artifactId version2.1/version scopeprovided/scope /dependency dependency groupIdorg.springframework/groupId artifactIdspring-webmvc/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-test/artifactId version${spring.version}/version scopetest/scope /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.8.2/version scopetest/scope /dependency /dependencies build finalNamejetty-template/finalName outputDirectorytarget/classes/outputDirectory plugins plugin groupIdorg.mortbay.jetty/groupId artifactIdjetty-maven-plugin/artifactId version8.1.14.v20131031/version configuration scanIntervalSeconds1/scanIntervalSeconds classesDirectory${basedir}/src/main/webapp/WEB-INF/classes/classesDirectory webAppConfig allowDuplicateFragmentNamestrue/allowDuplicateFragmentNames /webAppConfig scanTargets scanTargetsrc/main/java/com/springapp/mvc/scanTarget scanTargetsrc/main/webapp/WEB-INF/scanTarget /scanTargets /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.4/version /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.1/version configuration source1.6/source target1.6/target /configuration /plugin /plugins /build /project I can see, that maven realizes that files in source folder (src) had been changed, but does not compile into the directory: */src/main/webapp/WEB-INF/classes* I would really appreciate any help. I'm struggling with this issue now for 2 days... :( -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
The usual workflow (I think) is to just use mvn jetty:run (without any special configuration besides scanInterval) and have your IDE compile the classes into target/classes, where the jetty-maven-plugin will look them up: http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html If you don't use an IDE, then use any third-party tool to watch your files and invoke mvn process-classes when they change. On Thu, Apr 10, 2014 at 1:36 PM, Tom-Blank blank_...@rocketmail.com wrote: I'm new to Maven, but would like to achieve a hot deployment while changing source code (Java). My environment: - Maven 3.2.1 - JDK: 1.6 - Jetty 8.1.14.v20131031 What I would like to achieve is: Everytime I change something in my servlets, Maven picks it up and recompiles these files (if possible only delta). Then, once it's done it should copy/move the *.class files into the directory of my webapp. This approach is needed to speed up my development cycle like I'm used to it from developing in Grails and GGTS. I'm starting up the application by running: *mvn clean install war:inplace jetty:run* And Here is what I have: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdcom.springapp/groupId artifactIdjetty-template/artifactId packagingwar/packaging version1.0-SNAPSHOT/version namejetty-template/name properties spring.version3.2.0.RELEASE/spring.version jetty.version2.2.3E/jetty.version /properties dependencies dependency groupIdorg.springframework/groupId artifactIdspring-core/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-web/artifactId version${spring.version}/version /dependency dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version /dependency dependency groupIdjavax.servlet.jsp/groupId artifactIdjsp-api/artifactId version2.1/version scopeprovided/scope /dependency dependency groupIdorg.springframework/groupId artifactIdspring-webmvc/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-test/artifactId version${spring.version}/version scopetest/scope /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.8.2/version scopetest/scope /dependency /dependencies build finalNamejetty-template/finalName outputDirectorytarget/classes/outputDirectory plugins plugin groupIdorg.mortbay.jetty/groupId artifactIdjetty-maven-plugin/artifactId version8.1.14.v20131031/version configuration scanIntervalSeconds1/scanIntervalSeconds classesDirectory${basedir}/src/main/webapp/WEB-INF/classes/classesDirectory webAppConfig allowDuplicateFragmentNamestrue/allowDuplicateFragmentNames /webAppConfig scanTargets scanTargetsrc/main/java/com/springapp/mvc/scanTarget scanTargetsrc/main/webapp/WEB-INF/scanTarget /scanTargets /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.4/version /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.1/version configuration source1.6/source target1.6/target /configuration /plugin /plugins /build /project I can see, that maven realizes that files in source folder (src) had been changed, but does not compile into the directory: */src/main/webapp/WEB-INF/classes* I would really appreciate any help. I'm struggling with this issue now for 2 days... :( -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr
Re: Hot deployment using jetty 8 and maven
That is actually what my jszip.org toolchain provides... though I have neglected it for some time and I don;t think it works with Maven 3.1+ (should work with 3.0.5) and it might not be obvious when reading the docs that its not just about javascript modules but also about .jar modules trans-reactor Maybe someday soon I will get time to give it a refresh for Maven 3.1/3.2 On 10 April 2014 12:36, Tom-Blank blank_...@rocketmail.com wrote: I'm new to Maven, but would like to achieve a hot deployment while changing source code (Java). My environment: - Maven 3.2.1 - JDK: 1.6 - Jetty 8.1.14.v20131031 What I would like to achieve is: Everytime I change something in my servlets, Maven picks it up and recompiles these files (if possible only delta). Then, once it's done it should copy/move the *.class files into the directory of my webapp. This approach is needed to speed up my development cycle like I'm used to it from developing in Grails and GGTS. I'm starting up the application by running: *mvn clean install war:inplace jetty:run* And Here is what I have: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdcom.springapp/groupId artifactIdjetty-template/artifactId packagingwar/packaging version1.0-SNAPSHOT/version namejetty-template/name properties spring.version3.2.0.RELEASE/spring.version jetty.version2.2.3E/jetty.version /properties dependencies dependency groupIdorg.springframework/groupId artifactIdspring-core/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-web/artifactId version${spring.version}/version /dependency dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version /dependency dependency groupIdjavax.servlet.jsp/groupId artifactIdjsp-api/artifactId version2.1/version scopeprovided/scope /dependency dependency groupIdorg.springframework/groupId artifactIdspring-webmvc/artifactId version${spring.version}/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-test/artifactId version${spring.version}/version scopetest/scope /dependency dependency groupIdjunit/groupId artifactIdjunit/artifactId version4.8.2/version scopetest/scope /dependency /dependencies build finalNamejetty-template/finalName outputDirectorytarget/classes/outputDirectory plugins plugin groupIdorg.mortbay.jetty/groupId artifactIdjetty-maven-plugin/artifactId version8.1.14.v20131031/version configuration scanIntervalSeconds1/scanIntervalSeconds classesDirectory${basedir}/src/main/webapp/WEB-INF/classes/classesDirectory webAppConfig allowDuplicateFragmentNamestrue/allowDuplicateFragmentNames /webAppConfig scanTargets scanTargetsrc/main/java/com/springapp/mvc/scanTarget scanTargetsrc/main/webapp/WEB-INF/scanTarget /scanTargets /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.4/version /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.1/version configuration source1.6/source target1.6/target /configuration /plugin /plugins /build /project I can see, that maven realizes that files in source folder (src) had been changed, but does not compile into the directory: */src/main/webapp/WEB-INF/classes* I would really appreciate any help. I'm struggling with this issue now for 2 days... :( -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users
Re: Hot deployment using jetty 8 and maven
Hi Thomas, Thanks a lot for the hint. The mvn process-classes comes pretty close to what I need and it does the job by updating the classes directory with new compiled files. However, it would be great to execute mvn process-classes automatically anytime maven sees there have been source files changed. Is it possible to do so? -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839p5790843.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
Hi Stephen, Thanks. Actually, I don't mind using Maven ver. 3.0.5 as long as it does the job I need. Can you provide an example? Thanks! -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839p5790844.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
http://jszip.org/quickstart/index.html Then just modify some .java files and ask your IDE to compile on demand... while in a different window you just leave `mvn jszip:run` open and running. Maven will pick up the .class files and redeploy the webapp. After a while you may run out of permgen and you might need to restart the mvn process... but it should be OK for at least 5-10 cycles On 10 April 2014 13:56, Tom-Blank blank_...@rocketmail.com wrote: Hi Stephen, Thanks. Actually, I don't mind using Maven ver. 3.0.5 as long as it does the job I need. Can you provide an example? Thanks! -- View this message in context: http://maven.40175.n5.nabble.com/Hot-deployment-using-jetty-8-and-maven-tp5790839p5790844.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
However, it would be great to execute mvn process-classes automatically anytime maven sees there have been source files changed. This is just not a feature that Maven natively supports. You can get similar functionality out of your IDE. Or maybe your IDE can use an on save trigger to kick Maven to run process-classes? Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Hot deployment using jetty 8 and maven
On Thu, Apr 10, 2014 at 4:24 PM, Wayne Fay wayne...@gmail.com wrote: However, it would be great to execute mvn process-classes automatically anytime maven sees there have been source files changed. This is just not a feature that Maven natively supports. You can get similar functionality out of your IDE. Or maybe your IDE can use an on save trigger to kick Maven to run process-classes? FYI (and AFAICT), Eclipse with M2Eclipse does this automatically (runs process-resources, and saves compiled sources in Maven's build output directory) IDEA can be configured to use the same output directory as Maven too. Can't tell for other IDEs. -- Thomas Broyer /tɔ.ma.bʁwa.je/ http://xn--nna.ma.xn--bwa-xxb.je/
Re: Hot deployment using jetty 8 and maven
On Thu, Apr 10, 2014 at 09:24:31AM -0500, Wayne Fay wrote: However, it would be great to execute mvn process-classes automatically anytime maven sees there have been source files changed. This is just not a feature that Maven natively supports. You can get similar functionality out of your IDE. Or maybe your IDE can use an on save trigger to kick Maven to run process-classes? If it was mine, I'd check the changes into an SCM, which I'd have monitored by something like Jenkins. I'd want all those bits anyway. -- Mark H. Wood, Lead System Programmer mw...@iupui.edu Machines should not be friendly. Machines should be obedient. signature.asc Description: Digital signature
Re: Hot deployment using jetty 8 and maven
monitored by something like Jenkins. I'd want all those bits anyway. Agreed... but one step at a time. :) Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org