file saved outside from eclipse is compiled automatically? - java

I have a spring mvc web project configured in eclipse. Web application is running via tomcat server built inside eclipse. I have seen as soon as I change something and save the code, the project is rebuild and new web application is available for browsing. All this build-deploy is done behind the scenes.
If I have my project running on a server through eclipse and I changed one of project files from some an external tool like notepad++ and save it from there, will my new changes be build-deploy automatically in eclipse?
If not how can I achieve this functionality?

I guess if you will refresh project in eclipse after changed some file from notepad it will automatically be deployed.

Have you tried Window / Preferences / General / Workspace then check
Refresh using native hooks or polling
Refresh on access

Refresh the Project inside which file is changed and the project would/should be built automatically and published

Related

Separate GWT CodeServer from Jetty

I'm working with a GWT-Spring project, normally I use the default configuration to run the project with SuperDevMode (I use IntelliJ).
I'd like to run SuperDevMode without the embedded Jetty and I know to achieve that I just need to use: -noserver
I tried to use that option and at the same time run a Tomcat server using the same artifact I have with GWT to run the backend, but it's not working.
My question is, how can I run different servers, one for the GWT compiler and other for the backend code?
I just want to avoid to recompile the GWT application each time I have to restart the backend.
Let me know if there's a way to achieve this.
Thanks
I am not sure if this is the best practice, but it works.
compile your GWT project
create a dynamic web project
copy the host page, images, css, etc from the web content folder of the GWT project (including the compiled GWT code) to the WebContent folder of the newly created web project.
make sure that the newly created web project does not have GWT Facet in the project properties (otherwise everytime you start the Tomcat server, GWT will compile your source)
add the new project to your Tomcat server Run Configuration and start it
create a GWT Run Configuration (SDM), that looks like that:
and start with Debug
Hope that helps.

How to display changes in web browser when Building a RESTful Web Service using Spring?

I am following this tutorial:
https://spring.io/guides/gs/rest-service/
After completing the tutorial I run everything in my web browser on my local host and everything seems to work.However when I make changes in the java code (I made errors on purpose) I can still run everything in the web browser. What do I need to do in order for it to change due to my code changes? I guess I should mention that I am using eclipse and have installed maven as a plugin.
You are changing the source code, but not the compiled files. Your service is using the created "gs-rest-service-0.1.0.jar" file. This is not affected by your code changes.
Jump into the tutorial again where it says:
"Build an executable JAR"
This will rebuild your jar file. Afterwards you will have to restart your service like you did in the chapter "Run the service".
Instead of using maven as a plugin a choose to install it in order to use the command prompt.

Reloading of primefaces files in tomcat with Intellij IDEA

So I'm developing a Java application which has a Primefaces front-end. When I used Spring Tool Suite and started the project in tomcat I was able to edit the front-end xhtml files and they got reloaded on the webserver.
Now I've setup my Intellij IDEA to run my project in a tomcat, but I can't get my front-end files to be reloaded other than restarting the server.
Any advice on how to achieve this?
I actaully had to edit the Run Configuration and change On frame deactivation to Updated classes and resources
You have to use "Package File" option (or Ctrl+Mayus+F9) when you have edited the xhtml or modified classes.
You can also use "Update" option (or Ctrl + F10) and select "Update resources" or "Update classes and resources".

Tomcat inside of eclipse doesnt take into account my modifications

I'm using a Eclipse and have embedded Tomcat. My issue is that sometimes when I edit my servlet, even when restarting tomcat inside of eclipse, the deployed project doesn't update, and seems to me that it's using a cached version of the files compiled.
How do I do efficiently to make eclipse & tomcat take my modifications into consideration? What folder do I need to clean?
I have found a good solution that doesnt need me to clean project each time. With it the context is reloaded whenever I modify my servlet.
In eclipse, Goto Project and activate the checkbox Build Automatically.

Eclipse and JBoss not refreshing or rebuilding

I'm having this problem in eclipse (EE) when I change things in my code (even something as simple as the text I'm printing using println) it doesn't get applied. I'm using JBoss and when I rerun the servlet, nothing happens.
Any idea how I can force JBoss/Eclipse to do this? I can't preview anything so it's really annoying if I want to test some new code.
Thanks!
Eclipse publishes the newer versions of your application periodically (its called the automatic publish feature). Either the interval is too large, or you're not waiting sufficiently long enough for re-deployment, or automatic publishing of the application has been disabled.
Sometimes, despite ensuring the above, Eclipse might still not publish the newer classes, in which case you might want to perform a clean build, which causes the newly built classes to be loaded into JBoss.
Sorry to ask such a basic question: Do you save your changes before testing?
Eclipse uses its own compiler to check for syntax errors while you are editing, but you have to save the file before the edits take effect in the application.
I only ask because this could be confusing if you are new to Eclipse, having changed from a different IDE. File permission settings can also prevent your files from being saved or built.
Working on EJB deployed in JBoss with Eclipse IDE.
We have ANT build file, in which first old project is deleted from JBoss,
then compiling classes, & building proper directory structure & deploy as .ear - .sar again in JBoss directory.
Stop JBoss, run build file, start JBoss.
Its a good practice to have a build file to deploy project.

Categories

Resources