Reputation: 5684
So I'm facing into a problem that is slowing down my development process.
I'm using eclipse with tomcat 8. My software has 3 different tomcat servers that runs on different project.
As well my software is divided into 8 components, each one of the tomcat servers using some of the other projects.
For now I'm using Jenkins in order to build my software and deploying the jars into the web content folder of the tomcat servers.
The main problem is that to build it it takes 1 min, then I need to refresh all the projects in eclipse then restart the tomcat servers from eclipse.
I'm looking for an easier and faster way to do it.
Is there any way to point the tomcat servers in eclipse to actually look into the src
folders of the project instead of looking for the jars?
Upvotes: 0
Views: 106
Reputation: 5684
Had hard time to make @wero solution to work.
Found another useful workaround for this:
Right click on project -> build path -> configure build path -> source
Than you just linking the source of the other project into servlet one.
Upvotes: 0
Reputation: 32990
There is a technique to let Tomcat create web contexts from your eclipse projects instead of building and deploying to Tomcats webapp folder. The main advantage is that no build of a war
file or copying of classes (file like done by dynamic web projects) is needed.
Basically it involves the following:
bin
folder, dependencies on jar-files, possibly dependencies on other projects and a web
folder containing the webapp resources including a WEB-INF
folder.server.xml
pointing to the project resources needed by Tomcat to run the app. Tomcat is then fetching classes and resources from the project location.The above link describes how to do that for Tomcat 7. In Tomcat 8 the syntax for this technique has changed and would look like this (you get the idea):
<Context path="/mycontext" docBase="/myproj/web">
<Resources>
<PreResources webAppMount="/WEB-INF/classes" base="/myproj/bin" className="org.apache.catalina.webresources.DirResourceSet"/>
<PreResources webAppMount="/WEB-INF/classes" base="/myproj2/web" className="org.apache.catalina.webresources.DirResourceSet"/>
<PreResources webAppMount="/WEB-INF/lib" base="/myproj/lib" className="org.apache.catalina.webresources.DirResourceSet"/>
<PreResources webAppMount="/WEB-INF/lib" base="/myproj2/lib" className="org.apache.catalina.webresources.DirResourceSet"/>
</Resources>
</Context>
Upvotes: 2