I want to add an existing spring boot project into my Intellij collection project as a module.
Obviously if I open the spring boot project by itself, everything is configured correctly, but it's not configured correctly if I copy a spring boot project directly into the directory of the collection project where the modules go.
After I manually mark the directory as a sources root, I still need to set the classpath the way it would've been setup if importing the spring boot project directly.
What is the easiest way to finish configuring Project Structure for the directory so that it would work as if it was imported directly?
You can try to close the IDE, backup and delete all .iml files from your Spring project, open your main project in the IDE and use Import a module from existing sources to add your Spring project as a module.
Related
I have created a new SpringBoot project with the Spring initializr. I want to add git to the project to track it. In which folder would it be appropriate to initialize git?
I want to do it in the src folder but I fear it might not track all the files needed.
Init git at the root level of your project.
Your fear is justified, since many spring projects have many additional files that should be tracked in addition to your source code and resource files (documentation, pom.xml, etc)
I am new to Spring boot and angular so lease bear with me if something is not clear in the question or I am asking something trivial. I downloaded a sample project for learning purposes and I am able to deploy the application
Project structure
I have a REST spring boot application with an empty webapp directory
Angular project is a separate module which is built by running ng build in the parent folder and when the project is built the angular assets are moved to webapp folder of the spring project
Then running the mvn clean install I generate the war file for the application and deploy it using simple Run Application.java
Now the problem with the project is every time I make a change in the Angular project I have to re-deploy the whole application :(
I was wondering if there is a way to hotswap resources i.e. webapp files in the deployed war when I make changes to the UI using IntelliJ IDE
I have visited the following questions on this topic and nothing has helped so far.
StackOverflow Help
JetBrains support ticket
Spring Docs
I want to create webapp project using IDEA IDE, but I am confused with basic web setting. I have got standart maven-webapp project archetype with web.xml in src/main/webapp, with some spring code in src/main/java; Path for web.xml I have specified in Deployment Descriptors path. But what have I to specify in Web Resource Directories and Source Roots? Project Settings=> Modules => WEB. I am new to IDEA, everything works under eclipse, but not in IDEA. By the way, I need Servlets 3.0 specification, as I want to start Spring MVC based application using Java-based configuration: by extending AbstractAnnotationConfigDispatcherServletInitializer, not mapping via xml
I have some thymeleaf templates under maven src/main/resources/template path, when I change a controller java file, spring dev tools will trigger a restart, but when I change template files, the livereload does not work. At first, my maven had some problem building the project, it failed to add the files under src/main/resources to target/classes folder, then when I start the spring boot project(using spring tool suite), it showed a error that suggested templates not found. I rebuild the project use "mvn clean package" and restart the spring using spring dash board, it's OK. So I suspect that when I change the template file, it will not impact the target/classes folder, spring dev tools still get template from target/classes instead of detecting the changed file in src/main/resources/. Is there anything I miss to configure for spring dev tools?
Did you try to reload maven dependencies in the following way: in Package Explorer right-click on a project folder and choose Maven -> Update Project (ALT+F5). It helped in my case.
Do you want to auto reload Thymeleaf templates?
You may set spring.thymeleaf.cache property to false.
Reference: 72.2 Reload Thymeleaf templates without restarting the container
I have my main web application(has its own POM) that is dependent on module A((has its own POM).
When i make a build using mvn install on web application, it dependent modules
are also built in to jar file and ultimately included under WEB-INF/lib folder of main web app.
But that does not happen in when i make build using eclipse kepler (containing both maven projects i.e main web app and its dependent module A).
When building with eclipse, it just put the modified classes under moduleA/target/classes/ folder but does not make any updated jar file and put it
under WEB-INF/lib folder of main web app.
Is there a setting where i can configure eclipse building the project same way as maven does (which will really save lot of time and help in hot deployment) ?.
It used to work in one of my projects looks like some configuration is required for this.
looks like m2e connector(i have SonarQube) needs some configuration to make eclipse build in the same fashion as maven build
When i do the project > right click > mvn install , i am able to make jar file.
But what i want is eclipse build automatically option do
the build for project/module wherever modification is done , construct the jar and include it in parent WEB-INF/lib folder if it is dependent module ?
Assuming you're using the Java EE flavour of Eclipse, you can easily deploy Maven based web applications to a local server (like Tomcat, Wildfly...) from the server view.
m2e-wtp, included in recent Eclipse Java EE distros, takes care of configuring all Eclipse settings based on your project pom.xml configuration and dependencies.
See this screencast to see how simple it is : https://www.youtube.com/watch?v=TksoKkSP208
For the record, deployment/publishing is performed by each server adapter differently. They're responsible for publishing the proper jars under the WEB-INF/lib folder of the deployed application. Dependent jar projects are automatically zipped and deployed to WEB-INF/lib without user interaction