External project dependency in Vaadin

你离开我真会死。 提交于 2019-12-04 16:43:33

The solution was to add the external projects to the classpath of the Tomcat instance in Eclipse. Select

Run > Run Configurations > Apache Tomcat > (your Tomcat instance) > Classpath

Click Add Projects... and add the required project.

This will work for development. For deployment, the external project must be packaged as a library to a .jar file and copied manually (or using a build script) to WEB-INF/lib directory of the Vaadin project (see this answer on the Vaadin forum).

Another solution which will deploy your dependencies directly in the WEB-INF/lib is to :

- Add your external project to the Project / Java Build Path / Projects
- Add your external project libraries (assumed to be Maven here) to the Project / Java Build Path / Libraries
Click on Add Variable / M2_REPO and click on Extend to select the right library.
This part can be painful if you depend on many libraries.
- Add your external project and java build path entries in the Project / Deployment Assembly panel.
- Restart your Tomcat instance.

Check the content of the WEB-INF/lib directory under:
eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\your_ project\WEB-INF\lib

Take your external project and export it as a jar. Then copy your new jar and any dependencies into the WEB-INF/lib directory of your vaadin project. This will work in a deployment as well as development environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!