Spring boot, maven, AngularJS 2, typescript and live reload - maven

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.

Related

How i can do simple refresh on a gradle project using cmd or gitbash

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:

SpringBoot Devtools without IDE

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.

is it possible to run gradle in live mode

In sbt there is a live mode, if I use sbt ~run, then every time a java source changed, it will reload automatically. playframework also support that so that when change a source code, we don't reload manually. For gradle, I am running spring boot, but need to shutdown it and then startup after change some code, even if I am using --daemon, it still need some manually work. Anyway to load the code automatically?
A live mode for Gradle is in the works but not currently available. Plugins such as spring-boot may of course provide their own solution.

Spring Tool Suite: How do i clean Spring Tool Suite cache (if there is one)?

Few days back I created a maven project and i'm using angularJS for view, but whenever i make changes in the html file it doesn't show up after running the project, i clean the project countless number of times but the changes still don't show up.
But what i don't understand is that sometimes the changes show up the next day I run the project.
So is there some kind of cache that i need to delete after making new changes to my project??
I'm using STS Version: 3.3.0.RELEASE.
Thanks,
-Elysium
It sounds like your JavaScript files are not being copied over to the target directory properly. Make sure that after you do a build in the workspace that the proper version of the JS files are in the target folder on the filesystem (i.e., look outside of Eclipse). If the files are not correct, then your maven commands are not being completely invoked inside the workspace.
It's hard to say exactly what is going on without more information, but this sounds possible.

Reloading JSP Changes in Eclipse/STS

I'm just getting into GAE and I'm using STS (derivative of Eclipse). I'm currently getting a project set up to use Spring and Apache Tiles under GAE. I've got it mostly configured properly and it seems to work. My biggest problem is figuring out how others handle day-to-day developing in this kind of environment.
I make tons of changes to the front-end JSPs but so far it seems like I have to stop the GAE server and restart it every time I make a small change to a JSP. Having to restart when I make changes to the controller is fine, but having to restart it for a simple JSP change is driving me crazy.
Is there a way to have the GAE environment reload JSP changes in Eclipse/STS?
I'm using Maven for AppEngine project, so whenever I build the project, there will be a project target directory generated/updated which is where the server will load the files from. When I tried to update my jsp/css/js files, I always open the file in that directory and update it there. Once I'm satisfied with the it, I will copy the changes to my source file.
Essentially, I think for you, you can find out where is your target directory, and try to edit your files from there.
I'm not sure if my workaround is suitable for you but maybe you can get one or two here.
Apart from that, there are people using JRebel which is a hotdeploy tool. There is a AppEngine version of JRebel there, but I suspect it is not free...
I'd suggest to take a look at JRebel. Even if it is commercial software, it will save you a lot of nerves for this kind of development
You need to set parameter:
server.jsp-servlet.init-parameters.development=true
(Put it into application.properties if you use spring boot)

Resources