I was wondering whether is possible to use the devtools within spring-boot and Maven only, without any IDE.
My question is about quick changes tests, using sublime text or notepad++ and console mvn spring-boot:run.
As I know, It could be done using mvn compile in another console. But, I was thinking something simpler such as ng serve does in Angular.
I found two plugins for sublime and one for notepad++ which execute console command (in your case mvn compile) on save event.
SublimeCommandOnSave - this plugin is directly dedicated to run command on save event.
sublime-hooks - this one has a lot of more option than previous, you can fire diffrent actions (i.e console command, http request) on diffrent events.
In notepad++ case please refer this question.
Related
My project structure consist of both front-end(Angular) and back-end(Spring MVC) code. Whenever i do any front end changes normally i do npm run build from git-bash/cmd, after that i have to manually open STS, right click on project and do a normal refresh or f5(note: not gradle refresh), by this new bundle which is generated (by npm run build) will get loaded into project and published to tomcat server.
My queries:
1. I want to do a normal refresh (not gradle refresh) for my project from cmd/gitbash.
2. I want the club two command in into a single command, it is possible ? like doing the front-end code build and then normal refresh to project.
Not totally sure, but I think the 'Refresh using native hooks or polling' preference is the answer to your question:
When I develop spring boot gradle projects in intellij idea, if I want to change some code and restart the project, I have to click the Make Project menu item and this will trigger a gradle build.If the gradle deamon is dead, it will start first which is an upset process.
While in Spring Tool Suite, everything is so easy, just Ctrl S and STS will restart immediately witout the long gradle build. So is there any way to make intellij idea restart faster?
I know if the gradle deamon is alive, gradle build in intellij idea is not very slow and is acceptable. But on my computer, the deamon can usually live for only several minites. When I change some codes and want to see the effects, the deamon died. I have to start the deamon every time! Is there any other ways to make the deamon live longer?
Thanks a lot if there is any useful tips!
Well, thanks to #Gregg and #CrazyCoder 's comment, I found some useful links:
Developing/Debugging a Gradle-built Spring Boot app in IntelliJ IDEA
I accidently enable the delegate to gradle option in idea, which will trigger gradle build instead of idea's build, which is faster than gradle's. So disable the delegate to gradle option is a choice.
From another post, I get some idea to use the continuous build in gradle: open a terminal and run gradle assemble --continuous, when files are changed(for example save files or defocus window), gradle will compiles files automatically. Then run the spring boot app use gradle bootRun or from the tasks in idea, everything is ok. But this way will start two gradle so ram usages are larger.
Update:
I found another way to automatically compile. Fisrt, enable build project automatically option, then use ctrl shift a and input registry to open a dialog, and then enable compiler.automake.allow.when.app.running opiton. Finally, project will compile automatically and spring boot will also restart automatically.
I am in a study phase for an application development. The server-side development has already started, with Spring boot and Maven. Now, I am studying the possible options to develop the client-side.
I'd like to use Angular 2 (I know it's still in alpha), but I'm really hesitating between its javascript and typescript version. I know the live reload with javascript version should work well with maven spring-boot run (in theory), and this is a great help for productivity. I was wondering if there was a way to have the live reload for typescript version of Angular too. Has anyone managed to implement it in its own project? If yes, how did you do?
I have not found any doc about this on maven-typescript-plugin
The build system will be Maven for client side too.
EDIT: Is there an easy way for typescript debugging, or is it a pain?
One way could be adding a watch to automatically be triggered on any file change. For example, try adding the following to your package.json file:
{
"scripts": {
"tsc": "tsc -p src -w"
}
}
As the Quickstart for Angular 2 (literally) states that this will be activated when you open a terminal window in the root of the application folder and enter:
npm run tsc
The script sets the compiler watch option (-w) so the compiler stays alive when it's finished. It watches for changes to .ts files and recompiles them automatically.
Considering this will spit out plain-old .js files, you can use the tooling you're comfortable with to reload the page.
Is it possible to set an execution goal for maven so that the default browser is opened in a given url?
In my experience, Maven doesn't have the notion of a default system browser, nor does Java. There's some information here if you're looking to do this on Windows:
http://groups.google.com/group/comp.lang.java.programmer/msg/bd52c25dad8c1589
That solution also says that this is a platform specific detail.
My advice would be to write your own Maven plugin (surprisingly easy to do) and just set an execution for it under the part of the lifecycle you desire. If you could give me more details of the context under which you want to open a URL, I could help you with that. In my experience, any execution you define for Maven for a phase will happen after that phase. So, setting something for the deploy phase will cause your plugin to run immediately after the artifact is uploaded.
As far as actually opening the browser is concerned, I would recommend using Selenium 2 to accomplish that:
http://code.google.com/p/selenium/wiki/GettingStarted
The nice thing about Selenium 2/WebDriver (they're in the same API) is that it takes care of the logistics of finding default installations of things like Firefox and Chrome, and knows how to interact with that browser and open a URL. You could opt for a platform inspecific default (Firefox would be a good candidate), and if you have an exception opening it, launch Internet Explorer instead (there's no longer current Safari support in Selenium 2 however).
Combining those two things, Selenium 2 inside of a Maven plugin, should accomplish your goal quite well :)
I am on Grails 1.3.5 and IntelliJ 9.0.4 on a Mac with the latest JDK
I have the simplest of Grails projects: a helloworld that simply renders a string directly from a controller. I created it through the New Project wizard in IntelliJ. That went fine and IntelliJ picks up the correct grails SDK.
The problem is that IntelliJ makes me restart the app to see any changes I make to my code, (e.g. changing the "hello world" string.
If I edit the same controller with a text editor (eg TextMate) and run the app from the command line with grails run-app I do get hot code replacement, which is obviously what I want...
Anyone got a clue?
Some points:
I strongly recommend using the latest IntelliJ X EAP (http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP) since Grails support has been improved a lot since 9.0.x
If your IntelliJ config files got messed up, you can easily recreate them with 'grails integrate-with --intellij'. N.B. this recreates the config files in and old format and IntelliJ suggest to upgrade them - follow this procedure
Make sure your run configuration has uses at least the same memory settings than Grails uses when run from the command line, I'm fine with setting the 'VM parameters' field to '-XX:MaxPermSize=256m -Xmx1G'
If build problems occur (in rare cases the IntelliJ's internal compiler is more strict than plain Groovy), disable the 'Make' checkbox in the run config dialog.
If the problem persists, paste a screenshot of the run configuration you're using.