[ 
https://issues.apache.org/jira/browse/KARAF-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011407#comment-13011407
 ] 

james strachan commented on KARAF-222:
--------------------------------------

Hey David, long time no speak! :) 

Sounds like we're almost there. Some background...

So the really nice thing about "mvn jetty:run" is you don't have to wait for 
the build process to make a big WAR then copy it to your container which then 
unpacks it again; mvn jetty:run just watches your target/classes dir for 
changes then starts up the web app without needing the WAR. Then if you edit 
some code in, say, eclipse/IDEA and it recompiles it, the jetty:run plugin 
detects the classes changed in target/classes and restarts the WAR application 
inside the web container; without the JVM + Jetty restarting. So you get really 
RAD deployment of your application without really restarting the container.

Something similar would be awesome; where rather than making the jar of the 
bundle (so just the compile goal is done), a karaf is started (maybe some 
dependent bundles are started too), the target/classes dir is used to start the 
bundle of the project you're doing "mvn karaf:run" inside. Then if you change 
any code and its compiled by your IDE incrementally, karaf:run detects it, 
stops the bundle & restarts it again with the new classes.

Basically it gives you very fast re-run times as you don't have to stop + start 
maven or the JVM running Karaf; you just reload the bundle on the fly.

Karaf already supports the expanded bundle format already; so I don't think 
it'd be hard to do; its kinda like treating the 'target' dir as the hotdeploy 
dir for a new karaf container thats started in the "karaf:run" goal, then the 
classes dir is the bundle for the application; then it just reuses the normal 
karaf file watcher stuff so the bundle is reloaded if changes are made inside 
target/classes.


OK a slightly wacky idea now; I wonder if you're working on 3 different bundles 
in development which all work together inside Karaf; I wonder if it'd be 
possible to have a flavour of karaf:run where all you really mean is "deploy my 
target/classes as a bundle into the server X". i.e. so you could change code in 
any of your 3 projects and Karaf would auto-reload the bundles that changed. I 
guess you could do this today with a shell script, just creating sym links to 
your target/classes directories to directories inside your karaf servers deploy 
dir? Maybe there's a way to add a custom file type to Karaf's deployment which 
is a kinda pseudo file link to the developers IDE build of a bundle? So a maven 
goal copies myBundleName.link into your karaf servers hotdeploy dir; the 
contents of myBundleName.link is the full path of the ${basedir}/target/classes 
dir and Karaf interprets that actual physical dir as an exploded bundle to be 
watched?

> mvn karaf:run plugin, like jetty:run
> ------------------------------------
>
>                 Key: KARAF-222
>                 URL: https://issues.apache.org/jira/browse/KARAF-222
>             Project: Karaf
>          Issue Type: New Feature
>            Reporter: james strachan
>
> Did a quick google & couldn't see one yet - please close if there is one 
> already :)
> The really nice thing about jetty:run is it watches the source code & 
> target/classes dir & auto redeploys on change, so there's no deploy step - 
> you just hack & compile (which your IDE or incremental compile can do - e.g. 
> "mvn scala:cc").
> For added bonus would be being able to add some extra bundles, so it can be a 
> RAD way to hack bundles. Maybe folks could have some integration junit tests 
> automatically rerun whenever the bundle is redeployed?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to