combine application from several Eclipse projects

I created 2 Vaadin projects: 1st has the Application, the 2nd has a Composite editor component references from the 1st one.

The compilation is successful because I added the 2nd project to “Java build path” of the 1st one.
But when I start Jetty, the Application can’t find classes from the “Editor” project.

so, how should I configure Eclipse projects to combine Vaadin UI from several Eclipse projects? Can’t find this in the Book of Vaadin.

Jetty does not automatically know what your Eclipse project references. You need to make sure all of the required JARs or class files are in Jetty’s class path.

Alternatively, you could right-click on your Application project and do Export > WAR file. That should give you a self-contained package that you can run by itself in any Java application server (Jetty, Tomcat, etc.).

Finally, though, perhaps the easiest way would be, instead of using Jetty, to simply run it with one of Eclipse’s built-in servers. Go the menu bar and do Window > Show view > Servers. Right-click on the Servers view and choose New > Server. Then, I recommend you choose Apache > Tomcat v6.0 Server, click Next, Add your project to the server and then click Finish. You can now run this server straight from the Servers view and Eclipse will automatically pass all required dependencies to it.

There are 3 situations

For debugging, using Jetty with multiple projects is nice because you can debug and update your code and the web application does not need to restart all the time if you are just changing code inside a method. For this to work, you need to add the various directories to the classpath – here is my Maven configuration for running Jetty, see the “extraClasspath” entry. If you run Jetty directly, you will need to provide the equivalent setting through a property.


			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>7.2.0.v20101020</version>
				<configuration>
					<stopPort>9966</stopPort>
					<stopKey>${project.artifactId}</stopKey>
					<!-- Redeploy every x seconds if changes are detected, 0 for no automatic 
						redeployment -->
					<scanIntervalSeconds>0</scanIntervalSeconds>
					<reload>manual</reload>
					<webAppConfig>
						<contextPath>/${project.artifactId}</contextPath>
						<extraClasspath>target/classes;../criteriacontainer/target/classes</extraClasspath>
					</webAppConfig>
					<scanTargets>
						<scanTarget>../criteriacontainer/target/classes</scanTarget>
					</scanTargets>
					<systemProperties>
						<systemProperty>
							<name>net.sf.ehcache.skipUpdateCheck</name>
							<value>true</value>
						</systemProperty>
						<systemProperty>
							<name>derby.stream.error.file</name>
							<value>target/derby.log</value>
						</systemProperty>
					</systemProperties>
				</configuration>
			</plugin>

For development using Eclipse with Tomcat, as someone else has pointed out, you need to right-click on your Web application’s project and select the “deployment assembly” property. Use the “Add…” button to add the other projects you need. The problem with this approach, compared to Jetty, is that the Tomcat server will restart whenever you change your code. So it is not as convenient for debugging.

Finally, for deployment to your production server, you have two options: use Eclipse to export a war (Deployment Assembly will make sure that you have all your classes) or use Maven (the “package” goal will create a war with all your dependencies).

Thanks for the good suggestions!
I didn’t get an email update from the forum, so I forgot I posted this…

I tried using IDEA instead of Eclipse couple weeks ago and it worked perfectly.
But I’ll send this link to other people in my team who use Eclipse for development.

Yeah, this forum doesn’t send email notifications. You will have to check back manually once in a while. You can do that by clicking the
My Posts
links at the top of the forum. If a thread shows up in
bold
, new messages have been posted since you last visited it.

Probably again related to the bug in the Liferay forum portlet - see
this thread
.

As an additional hint, as I have been struggling with this for some time:

When you develop a widget in one eclipse project and try to use it in another one (app project), you also need to link the source folder of the widget project into the app project. Otherwise the gwt compiler does not find the source and you can not use the development mode.