How to Pick up CSS Changes in GWT Application - gwt

Using Tomcat, I build a new WAR via Maven. Then I copy the output WAR to $TOMCAT_HOME/webapps. Then, ROOT.war becomes exploded and ROOT appears.
If I modify ROOT/style/core.css, will those changes be picked up by my web app at run-time when I re-run $TOMCAT_HOME/bin/catalina.sh start?
Note, this is a GWT application.

If you change files in the exploded WAR directory inside your webapps folder, the changes will immediately be visible. You don't even have to restart Tomcat for this to work.

I think there is a dev mode for GWT that will load the CSS as a static file distinct from the rest of the app. This wold enable normal editing of the file on disk to be seen in your gui.
https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#DevGuideDevMode

Related

gwt images external to WAR file

I am working with GWT and I have some issues with the images. I need images outside my WAR file and, In order to make them visible in the application, I must put them inside the "target" folder ( I am using maven as well). The problem is that the target folder by definition is deleted every time recompile the project. This issue happens only in hosted mode, because when I deploy the application on Tomcat I can just change the server.xml adding the following statement
and it should read correctly images outside my WAR file(not tried yet due to another problem I have)
Can anybody give me some suggestions?
What is the directory structure of your maven project? Why is there a requirement for you to put the images in the target folder? Typically in a Maven project the items you put in the src/main/resources/static such as images end up in the built artifact.

Glassfish step by step hot deploy

Hello i would like ask how it is possible configure glassfish server for something like live, hot deployment:
every time when i change some code of my jsp,html,js or css file i always need to clean and build project than deploy project to glassfish and again, again and again. That cost a lot of my time. I waste time for that. It will be easy when i could work on files which already use a started glasfish (deployed). But this files is in WAR file "project.war" and through my IDE (Netbeans) i cant edit this files (jsp,css,html or js). Netbeans made this file non editable.
Do you have idea how to speed up my development? I Will grateful for help.
Here is my glasfish home folder and all of 2 deployed applications are empty
yes, you can. if you need change xhtml, js, css only you can do this after your war was deployed. You can find all the files in the folder of your application
****\glassfish-4.1\glassfish\domains\domain1\applications\MyWebApplication\
when you complete your changes you need copy them to project folder and rebuild war

temporary folder into eclipse

I am developing a Java application with Eclipse and under Apache Tomcat.
when I load an image it puts it in this directory : C:\wamp\www.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myproject\.
If I want to display the image I should refresh the directory (images) in Eclipse.
Does that happen only when I use Eclipse? And if I deploy the project, will the image be loaded always in this folder or in any folder?
When you create a Tomcat project with Eclipse, you have a special folder where you can copy your web resources to, e.g. images, CSS files, and the like.
When you deploy your web application, Eclipse will package it correctly to make sure the images and CSS get copied over.
Make sure you use relative paths, not absolute paths. Also I would recommend you write a maven script or ant script to handle packaging and deployment instead of using Eclipse. It is cleaner and you understand better how things work.

Deploy a War file with Eclipse and Tomcat 6 without a build file

I know there are a bunch of posts on this topic, but I can't seem to figure it out. Here is my setup:
- Eclipse Indigo
- Tomcat 6
- Struts WAR file that I imported into Eclipse from http://www.manning.com/dbrown/SampleApplication.zip
I added the server to Eclipse, and added the project to the server. It runs fine, but I'd like to make some changes to the XML and java files (not the jsp files). I was under the impression that Eclipse takes care of the deployment after I save and restart the server, but I guess this isn't the case. I looked into creating an ant file to do a custom build, but I'm not really sure how to make it since I don't even know how to do a deployment "manually". How would I go about doing a manual deployment? Thanks.
A war file is usually created by exporting it from an IDE like eclipse, netbeans, etc.
While generating a war file there is 2 options,
You can include your java files with it
You can avoid java files from it.
In both the cases class files will be there which are created from java files. Class files will be able to take care of the actions of java class.
If the war file which you down loaded is not having those java files, you will not be able to use it with eclipse, where as it will work fine if you are putting it into tomcat directory for running.
For running a war file manually just put it into tomcat webapps folder and run tomcat.
Then you can access the pages using the url.
http://localhost:8080/yourprojectname/
If you want to check whether the war file contains any java files, after starting the tomcat server it will extract the war file into the same directry, where you can search for java files.
If you want to run the project from eclipse,
import it into eclipse, open index.jsp page
right click-> run as-> run on server
if you have not yet configured the server yet,select the server in the list, specify its installation path, then add projects into server in next step, finish it. then it will load your project.
Please provide little more details so that we can help you better.
manual: copy the war in the tomcat folder then start tomcat.
if you want to use eclipse you need to click redeploy war first by right clickling the deployed war in the servers tab under tomcat.

Deploying a WAR in Tomcat / Eclipse

I use Tomcat 6.0 and Eclipse 3.0 under Linux and I try to deploy a WAR in Tomcat. The problem is that the server is managed by Eclipse and I have some Eclipse project deployed. I tried to modify the server.xml file then launch Tomcat via Eclipse but it doesn't work:
Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete.
I tried to extract the war in the webapps directory but the webapp is still inaccessible.
What is the best practice to deploy a War ?
Tomcat behaves differently in development and production mode. When you develop your webapp in Eclipse there is no reason to deploy a WAR file of your application as a WAR during development.
Just go to the "servers" view and add a new server (you should already have done this otherwise you could not create your Dynamic Web project). In the server view you should see the server you created (Tomcat at localhost or something similar) just right click it and go to the Add and Remove section. Here you can add and remove the Dynamic Web projects you created in Eclipse. Once you added your project, all you have to do is click the green start button in the servers view and your app should be available in at localhost:8080/mycontext.
When you're done building your app just right click the project and go the the Export section in the menu. You should be able to export a WAR file. Once you have your WAR file you can upload and deploy that on a Tomcat instance that is NOT tied to Eclipse running in dev mode.
Yes, in a way, you can deploy a war in the dev mode.
I have the same problem.
I have an Eclipse webapp project, which Eclipse deploys to an instance of Tomcat run by Eclipse, so I can hot-edit the project.
This Web project needs to use resources published by another webapp that has to be run within the same instance of Tomcat. The other webapp is a completed project by someone else, so it is already in a war form.
I needed to File->Import the war as an Eclipse project and let Eclipse deploy it to the same instance of Eclipse, in order to run it in the same instance of Tomcat in which my webapp also runs.
The problem is that some wars work this way but some others do not, while all of them work perfectly fine in a stand-alone Tomcat (started by startup.sh). I can't figure out why.
This is old but is one of the first answers in google search.
You can import the war file:
A Web Archive (WAR) file is a portable, packaged Web application
that you can import into your workspace.
Before importing a WAR file,
you should first determine if the WAR file contains needed Java™ source
files. When importing a WAR file into an existing Web project, the imported
Web deployment descriptor files are either not changed or overwritten by the
ones included in the imported WAR file, based on your response to the prompt
that is provided. In either case, this action does not represent a
merging of the two sets of deployment descriptors.
To import the
Web project resources in a WAR file into your workspace, complete the following
steps:
Select File > Import
.
In the Import dialog, select WAR file and
then click Next.
Locate the WAR file that you want to import using the Browse button.
The wizard assumes you want to create a new Web project with the
same name as the WAR file. If you accept this choice, the project will be
created with the same servlet version as specified by the WAR file and in
the same location. If you want to override these settings, you can click New and
specify your new settings in the Dynamic Web Project wizard.
Click Finish to populate the Web
project.
Source: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.wst.webtools.doc.user%2Ftopics%2Ftwimpwar.html
If all you have is a binary WAR (no source code), it cannot be installed within Eclipse. This can happen in certain scenarios outside of normal development workflows. Here's the work-around solution:
Launch another instance of Tomcat (outside Eclipse).
Modify the tomcat-users.xml file to enable admin
Go to http://localhost:8080/manager/html
Scroll down to WAR file to deploy
Click Choose File (next to Select WAR file to upload) and click Deploy.