Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse publishing to Tomcat

I recently came back to using Eclipse after 2 years of IntelliJ. Things have changed.

Now when I try to run Tomcat, it tries to publish my project to it. What the hell is publish?

What ever happened to pushing a war into the webapps directory and letting Tomcat deploy it?

Right now my deployment is broken because of compilation errors. I have a feeling that Eclipse is taking my project and copying it to webapps dir without first building it properly.

Can someone explain to me what exactly publishing does, and also how to turn it off and use Tomcat like normal people?

like image 447
mkoryak Avatar asked Oct 20 '10 13:10

mkoryak


People also ask

What is publish in Tomcat Eclipse?

The Publish option in the server tab will deploy the application to your Tomcat instance by copying the project resources such as xml configuration files , web resource (html ,css, js etc) , and the compiled . class files you get from the "project > Build" to the correct location of the Tomcat instance .

How do I know if Tomcat is running in Eclipse?

Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.


2 Answers

A the "Servers" view, you can double click on your Tomcat instance, to open the server settings editor.

There, at the upper right corner, you can find the Publishing options. Check the "Never publish automatically" option, and save.

With this it should be enough.

Oh, and by "Publishing", they kind of mean "Deploying", or "Copying to the deploy directory", depending on what server you are using.

like image 144
Tomas Narros Avatar answered Oct 11 '22 16:10

Tomas Narros


Eclipse (Helios) makes a copy of your entire Tomcat configuration and starts a new instance of the Tomcat server when you are running the web application from Eclipse. That is why you must shut down any existing Tomcat service before running in Eclipse.

The application runs out of your workspace, not out of the "webapps" folder. Eclipse modifies the copied server.xml file to add "CONTEXT" tags that include your workspace project folders in the running application list.

The path in the "CONTEXT" tag should be the name of your project folder.

You can export the project to a WAR file and deploy your web application to the webapps folder if you want.

like image 5
Mike Pettigrew Avatar answered Oct 11 '22 14:10

Mike Pettigrew