- This topic has 17 replies, 5 voices, and was last updated 20 years, 3 months ago by Riyad Kalla.
-
AuthorPosts
-
MikeMemberDo you have a recommendation on setting up a directory structure to match the natural Tomcat webapps directory structure? I believe, but I’m not sure, that MyEclipse should now be capable of allowing this type of structure:
WebApp1 -> /tomcat/webapps/app1 (default context-root = “”)
WebApp2 -> /tomcat/webapps/app2 (context-root = “app2”)
WebApp3 -> /tomcat/webapps/app3 (context-root = “app3”)
Shared Jars -> /tomcat/shared/lib/
Shared Classes -> /tomcat/shared/classes/It seems MyEclipse is flexible enough to handle this, but I can’t quite figure out how.
Additionally, should this be set up as one project (with access to all webapps and the shared/classes files on the project tree)? Or would it be necessary/better to set up a different project for each webapp?
Thanks.
Riyad KallaMemberGood question, what you described above should be modelled as 3 separate Web Module Projects (WebApp1, 2 and 3). As to how best to setup EACH of these projects, please see this FAQ entry:
http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-30.html#111As far as “Shared JARs” these are 1-time-install JARs (e.g. JDBC driver) so these can be copied into the Tomcat install, and then added to the project’s build path from within Eclipse using the Project Properties > Java Build Path, and clicking Libraries tab then clicking “Add External JAR” and pointing to the appropriate JAR(s). As far as shared classes go, you will need to place these manually in their necessary location and add them to the class path if necessary.
Other than that, once you have these 3 projects setup, you will be able to setup deployments for them so they can be deployed/run/debugged from within MyEclipse to your Tomcat installation.
Here is a demo of setting up a standard web module project, deploying it and debugging it: http://www.myeclipseide.com/images/tutorials/webprojectdemo.htm
And here is another demo covering in more detail the steps used for a Struts project: http://www.myeclipseide.com/images/tutorials/StrutsTutorial.htmThese should give you a good idea of how MyEclipse behaves on a per-project basis so you can see how best to handle your example webapps you gave above.
Michael SchulzMemberRiyad, in your response, you failed to mention whether or not myeclipse now supports the “natural” (exploded WAR structure) as a project structure. I know this is not supported in v2.7.0, I’m still trying to figure out if it is supported in v2.7.1, and I’m expecting it to be supported in v2.8.0.
Any words of wisdom for us on this issue?
Thanks,
Mike
Riyad KallaMemberMike,
Our required project structure has always been exploded WAR format for our Web Module Project. More specifically, the project structure of a Web Module Project must mirror an exploded WAR file, with the WEB-INF dir in the appropriate place, the web.xml file, libs, classes and other supporting files all in appropriate locations. In the 2.8 release we are focused on more flexible non-WAR project structure for people that use complex Ant scripts to build their web project.Your original post was asking about using a “Tomcat-like” project structure, to which I replied “You cannot model a single project like that, but what you gave above will actually be modelled like 3 separate projects in MyEclipse”.
Have you tried setting your projects up in MyEclipse yet as I suggested? Or watching the demos I linked to? Or looking at the FAQ entry? All of these things are quite clear on the required project structure, which is a exploded WAR format. If this is infact what you are already dealing with (meaning your existing project is already setup like this) then following my directions on setting them up in the previous post as 3 separate Web Module Projects would have been extremely smooth.
If there is some more specific question that I am not addressing, please let me know so we can get you up and running.
MikeMemberOkay, almost there…but do you really mean there is no support for shared classes (a’la tomcat/shared/classes)?
Do I really need to put the java/class files in webapp/app1/WEB-INF/classes? Is there a way to share these classes across webapps from a central source?
I tried adding tomcat/shared/classes as a linked “classes” folder to the project build path. I ended up with the folder structure below, but my class import (com.mycompany.ConnectionPool) was not recognized in index.jsp within Eclipse (“The import com.mycompany cannot be resolved):
app1
src
JRE
J2EE
log4j jar
WebRoot
META-INF
WEB-INF
index jsp
classes (linked to tomcat/shared/classes)
com.mycompany.ConnectionPool.java
com.mycompany.ConnectionPool.class
Michael SchulzMemberActually, Riyad, I did not make the original post — “whynot” was the original poster. I just responded to your reply since it seemed relevant to an issue that I have with myeclipse.
Perhaps I should clarify my desire:
Our web application has the following structure:C:\tomcat-5.0.19\webapps\mywebapp
—-index.html
—-jsp\
——–myJsp1.jsp
—-templates\
——–myTemplate1.html
—-WEB-INF\
——–classes
————mywebapppkg
—————-myClass1.java
—————-myClass1.classIf I understand the J2EE spec correctly, this is the structure of an exploded war file, is it not?
myeclipse uses a “WebRoot” folder, and I understand why it is used, but I have a (big) project that does not use this structure.
So, this is what I’m looking for? Will it be supported with v2.8.0?
Thanks for any advice or clarification.
-Mike
Riyad KallaMemberActually, Riyad, I did not make the original post — “whynot” was the original poster. I just responded to your reply since it seemed relevant to an issue that I have with myeclipse.
My mistake, thanks for clearing it up.
C:\tomcat-5.0.19\webapps\mywebapp
—-index.html
—-jsp\
——–myJsp1.jsp
—-templates\
——–myTemplate1.html
—-WEB-INF\
——–classes
————mywebapppkg
—————-myClass1.java
—————-myClass1.classThis shouldn’t be a problem at all, what you will want to do is setup your MyEclipse project so it looks like this:
+ mywebapp (Project Name, Root Node) + /src (Java source code) + /WebRoot (default webroot name, can change from MyEclipse J2EE/Template prefs) + index.html + /jsp (Your JSP dir) + myJsp1.jsp + /templates (Your template dir) + myTemplate1.html + /WEB-INF + /lib + /classes (This becomes your Output dir for compiling)
And now when you setup your deployment, everything frrom “WebRoot” down gets copied into whatever Tomcat context (you called it “mywebapp” in above example) you end up giving the project. The end result will be the same thing you have now, based on your example. If you check out the FAQ link from my reply to the other user, you see that the “WebRoot” dir becomes the WAR file root, this allows you to keep things in a project (like /src, /docs) that are outside of the webroot and won’t get deployed to the app server.
Scott AndersonParticipantRiyad’s answers to Mike are spot-on, so I just want to add some clarity to this question by ‘whynot’.
Okay, almost there…but do you really mean there is no support for shared classes (a’la tomcat/shared/classes)?
In the 2.8 Beta 1 release we just put on the server a few minutes ago, we’ve added a ‘Smart Deployment’ feature that allows you to specify how you’d like to handle Java projects that are on your web project’s classpath. So, by placing all your shared code in a Java project and then adding that project to the classpath of your web project you’ll be able to share the code among multiple web project just as you’re trying to do. You can see an example of this in the New & Noteworthy section here:
http://www.myeclipseide.com/ContentExpress-display-ceid-50.html
You’ll have to scroll down about 7/8 of the way to the section called ‘Dependent Project Deployment’.
Michael SchulzMemberI want to work directly in the tomcat/webapps/mywebapp structure – I don’t want to have to declare a separate project structure, and I don’t even want to have to use a “deploy” function. Can I do that?
-Mike
Riyad KallaMemberI want to work directly in the tomcat/webapps/mywebapp structure – I don’t want to have to declare a separate project structure, and I don’t even want to have to use a “deploy” function. Can I do that?
😐
Ok, so what this would require is that your ‘webroot’ is actually your project root directory… this was a request, but I’m not sure if it was addressed in the 2.8 Beta release, you can try it and see. If it IS supported, then what you can do is create 3 projects, but actually point their Eclipse project directories to c:\tomcat 5.0.19\webapps\webapp1, webapp2, webapp3 and when you create the new web module project, set your webroot dir to “/” to make it the project root.
I have to admit I can’t understand why you are trying to do this, but we will try and facilitate it as best we can.
Michael SchulzMemberOk, so what this would require is that your ‘webroot’ is actually your project root directory… this was a request, but I’m not sure if it was addressed in the 2.8 Beta release, you can try it and see.
Yes, this is what I’m looking for – and I know from searching the forums that I was not the only one that requested this feature. One reason we want to use this approach is for simplicity – we don’t need a “deploy” step using this approach. Another reason is that we don’t deploy our webapp using the tomcat deploy function – the tomcat servers are updated directory from CVS.
Thanks for trying to meet our needs, even if you don’t understand them.
-Mike
Riyad KallaMemberOk I think I understand better what you are doing… makes more sense now 😉
If Beta1 doesn’t work for you to do this, I believe we are going to have 2 more betas that will continue to introduce new functionality so don’t loose hope if its not in immediately.
Michael SchulzMember@support-rkalla wrote:
Ok I think I understand better what you are doing… makes more sense now 😉
If Beta1 doesn’t work for you to do this, I believe we are going to have 2 more betas that will continue to introduce new functionality so don’t loose hope if its not in immediately.
I’ve been able to do some configuration and testing with the v2.7.1 release. I can configure my application correctly, and almost everything works the way I wanted. The one exception is breakpoints in my .jsp files – they don’t get hit.
To clarify, I am working with a project structure that matches the exploded WAR structure using Tomcat5.0.19. I don’t have a /src and a /WebRoot folder – the root directory of my project contains my WEB-INF folder, my index.html file, and folders for my jsp files. I do not even use the deploy option at this time.
Any thoughts on why breakpoints in .jsp’s don’t work?
-Mike
Riyad KallaMemberI’ve been able to do some configuration and testing with the v2.7.1 release. I can configure my application correctly, and almost everything works the way I wanted.
Nice job! What are your settings under Project Properties > MyEclipse-Web? I’m curious what you had to set those to…
The one exception is breakpoints in my .jsp files – they don’t get hit.
I’ll ask about this, as I don’t know. My 2-cent suggestion while you wait though is to make sure you are running the app server in Debug mode (Window > Preferences > MyEclipse > App. Servers > Tomcat 5 > Launch > “Debug”, and also make sure you are running Eclipse with a 1.4 VM and running Tomcat with a 1.4 VM)
mvinceletteMemberI have been unable to get this to work. I hate to keep asking, but any idea when this type of directory structure will be supported? (As a reminder, lots of folks just want to use the project root as the webroot and not use the deployer at all for the reasons Mike explained above. Another reason for this is that our HTML folks would find it a ridiculous hassle to have to edit files and then deploy in order to test them, so we will not adopt the standard structure the ME demands. Debugging should work and ME should not produce gazillions of “not in webroot” errors.)
Can someone look into this and give a more definitive answer? I can’t continue to use MyEclipse if this feature is not being introduced, but I’ve stuck with it despite the hassles b/c this feature keeps being promised.
-
AuthorPosts