0

I have uploaded a Java project to the Tomcat server in Eclipse and when I want to change it to a new project, the changes are not applied and the old project is always displayed.

I need to change the Java project to see it at localhost, This is what I tried to do:

  1. Open Eclipse and create new Vaadin 7 project

  2. Install Vaadin and Apache Tomcat at Eclipse marketplace enter image description here

  3. Create a tomcat server and change in debug configuration with the name of the first project. And write into Web Browser localhost:8080 and visualize it.

  4. Change on debug configuration the name of the new project: enter image description here I add the new project and delete the old. enter image description here

When I do all this, the old project one is always displayed in the browser and not the new project like I want to do.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
  • 3
    You are asking about an Apache Tomcat run configuration, but all your images show a Maven run configuration, which runs the project using Jetty. – Piotr P. Karwasz May 04 '21 at 18:39
  • Sorry, I recently started programming on this technology. I appreciate your comment, because it makes me improve – pablo villa May 05 '21 at 07:11
  • There are many ways to start a server in Eclipse. One of them is the [Servers View](https://help.eclipse.org/2021-03/topic/org.eclipse.wst.server.ui.doc.user/topics/rwrcview.html?cp=90_4_0_0), which allows you to configure the Apache Tomcat run configurations and the _"Run as > Run on Server"_ action on web projects. – Piotr P. Karwasz May 05 '21 at 08:45
  • If you **really** want to start Tomcat using Maven, there is an old [tomcat7-maven-plugin](http://tomcat.apache.org/maven-plugin-trunk/run-mojo-features.html). However this way you won't be able to run multiple projects on the same server. Using the _Servers View_ on the other hand automatically takes care of source lookups, when you add a project to a server. – Piotr P. Karwasz May 05 '21 at 08:54

2 Answers2

0

see this post https://mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/. Even though the hot deploy will only be applied if you add a new method or class.

  • Thanks for your answer Melainie, I have no problem with the changes within the project, my problem is when I want to visualize a new project locally, that I am not able to change the old one for the new one in the local tomcat server – pablo villa May 04 '21 at 15:38
0

It seems like you are not using Tomcat but Jetty through a Maven goal invoked by a Debug configuration in Eclipse. Tomcat and Jetty are two different web servers that you can use to deploy Java web applications including Vaadin apps.

Maven is a project management tool to configure dependencies, packaging, deployment, testing, and more. A Maven goal is a task that Maven performs. One of those tasks is running a Jetty server with the application deployed in it. It's like if your application included (although it's not really true) a ready-to-use Jetty server. This is configured in the pom.xml file, and you can run it by executing the jetty:run goal.

You can run a Maven goal using the command line or a Debug/Run configuration in Eclipse. For example, to start the Jetty server declared in each Vaadin project, can execute mvn jetty:run in the command line or create a Debug/Run Maven configuration that specifies the jetty:run goal.

If you have two Vaadin projects, each one declares a Jetty server for developing and testing purposes (so you don't have to install your own). And you can run it as I described before. Just make sure that the port is free before starting a server. By default, this port is 8080. Most likely you want to stop a running Jetty before starting another one. If you need both running at the same time, you have to configure the port.

Some things to consider:

  • When you want to build your Vaadin application for a production environment, you have to activate the production profile (available if you created the project using one of the tools at https://vaadin.com/start). You can do this in the command line by executing mvn package -P production. After this, depending on your packaging configuration, you can deploy the WAR file to an external (Jetty, Tomcat, or any other) Java server, or run the JAR file in a production environment. This video shows how to build a Vaadin app for production.

  • This article explains the main concepts in Maven, in case you are interested in learning more about it or refreshing your memory.

  • This video shows how to create and run a Vaadin 7 application in Eclipse. Note that Vaadin 7 is not the latest version of the framework and things have changed since. Check this tutorial for more recent versions of Vaadin.

Alejandro Duarte
  • 1,365
  • 8
  • 15
  • Thank you very much for the answer Alejandro, my problem was that when I changed the jetty dependencies it did not restart the server and that is why it did not update the new project in Localhost. I am very sorry for my low level, I am trying my best to learn this technology. All the best!! – pablo villa May 05 '21 at 13:31
  • Thanks for sharing the solution to the issue. Don't apologize for learning! We all started from zero. Anyway, I'd still suggest creating two separate run/debug configurations, one for each project. – Alejandro Duarte May 05 '21 at 13:44