How to develop spring boot application with pure text editors?
And with hot reload after you save your source code file. With build tools like maven or gradle.
It turns out you could install spring-boot-devtools to your pom.xml before start.
Start your application with command line
$ mvn spring-boot:run
As long as your text-editor support auto compile, it will reload.
I am using vs code in this case. A java compiler will popup for installation while you edit your source code. Amazing.
Related
Need some help in running Spring Boot Application, I have cloned a Microservice and Imported into Eclipse. Now I want to run this as spring boot application in my STS(4.10.0 version). While running I need to supply profile. For this I am setting up configuration (Run Configuration).
Steps :
Right click on Project
Select Run As > Run Configurations
Select "Spring Boot App" -> Click to Add new Configurations
Here I am unable to select Project, it is not displayed in drop down. Below is screenshot
Note : I tried Importing Project as "Maven Project", "Existing project Into Workspace" and Git project into workspace. All these 3 ways are not working for me
Need help
This looks like your project is not recognized as a Spring Boot application. Without looking at your project it is hard to say why the IDE doesn't identify your project as a Spring Boot project. Does that work when you create a new Spring Boot project using the Spring wizards? Also feel free to share a link to your project, we would be happy to take a deeper look.
As a workaround, you can always start your Spring Boot application as a regular Java Application using the "Run as Java Application" in the IDE. That way you would have to set the active profiles via a system property in your launch config.
Oddly, I had this issue for a spring boot maven project and it was pom.xml being malformed even with no warning or error. Took me days, I had imported/re-imported/messed with the java build path/compiler and installed jres. I was unable to download maven dependencies. I took a look in the dependencies section of the pom.xml and noticed lifecycle-mappings issue. Once I took out the 3 lines of incorrect xml syntax in the pom.xml I was able to download the maven dependencies and then the project appeared as a spring boot project in run configs.
Before I start, I'd like to say that I already tried the solution proposed in spring-boot-devtools reload of multi-module maven project changes, which didn't work for me.
Problem:
I have a multi-module Spring Boot project of this sort:
The module launcher has a Maven dependency on module GUI. I launch my Spring Boot application from the main method in launcher.
When I run the application and change any HTML file in GUI module, the spring-boot-devtools dependency doesn't do a live reload of these changes for my running application. Not even manual restart of launcher helps. I need to compile GUI manually and then run launcher again.
What I tried:
I tried defining the spring-boot-devtools dependency first in
parent pom.xml, then in GUI module only and then in both at the same time.
I tried adding spring.devtools.restart.additional-paths=../gui in my application.properties file as suggested in spring-boot-devtools reload of multi-module maven project changes. This does indeed trigger the reload (according to the log), but those changes just don't propagate to the jar file of GUI dependency. Also, before I even made this project into multi-module, there was no need for reloading just because of HTML files (nothing is being compiled) and I could see the changes right away.
I use Netbeans GUI if that's of any help. I also tried running the project from command line, with no success. The Maven packaging on all modules is set to jar.
The fact that this works when you configure absolute paths in devtools tells me that this is mainly a work directory issue.
So this means that:
configured paths should be relative to where you launch the CLI
you should configure the same location as a work directory in the run configuration of your IDE (whatever configuration your IDE is using to launch your application should have such an option)
In your case: everything should be relative to your launcher module; this should be as well your work directory in your IDE.
I have no idea how it happened, but upon one revisit it started working without me knowingly changing anything. It doesn't even require the spring.devtools.restart.additional-path property set.
Could've been a problem of Netbeans IDE perhaps? Then again, it didn't work from command line either. If anyone has any explanation for this, it'd still be grateful as it may prevent this problem from happening in future.
Can JRebel reload Kotlin classes when they are used by kotlin-maven-plugin plugin on Maven?
The project runs on an application server.
JRebel will reload kotlin classes provided they are compiled either via IDE or manually by invoking maven compile.
Also the classes must either be compiled to the path specified in the rebel.xml or to the classloader's classpath(e.g. when using exploded deployment with target/classes or target/artifact-name/WEB-INF/classes as the root).
Usually achieving this requires no extra steps and it should be just: Enable JRebel -> Start server & deploy application -> Make changes -> make/compile to reload
If you have not done so yet, please try the free trial at https://zeroturnaround.com/software/jrebel/trial/
and report back any issues and suggestions to support#zeroturnaround.com
I'm using IntelliJ 14.1.1 on Windows.
I have a project (mainly java) with a little web module, built with maven.
In my web module, I'd like to accomplish this scenario :
I edit a Javascript file located in the web module, folder resources/js
When IntelliJ automatically saves the file, I'd like it to be copied automatically to target/classes so that my web server detects the change and reload it automatically.
My goal is to have immedlate feedback : I edit a JS file, and then I have it available in my browser.
The only way I found is to go to "Maven Project", and assign a shortcut to the maven goal which compiles the module. But this takes too long, and it's far from the "Ctrl+S" of Eclipse (Eclipse auto build let me have this behavior).
I also tried to use the File Watcher option of IntelliJ, but it seems it can only parse less/css and I cannot make a simple copy of file/folder with it.
Any help would be welcome to achieve such an immediate feedback on typing in IntelliJ.
Thank you
Is it necessary to install spring ide in eclipse to use spring security in a web application jsf2.0, although I added all the necessary .jar.
No, you can make a spring application without the ide installed. The ide just makes developing with spring easier with things like Advanced code completion, content-assist, validation, ... etc.