- This topic has 35 replies, 6 voices, and was last updated 20 years, 10 months ago by kivus.
-
AuthorPosts
-
dickonMemberI’m testing out the new RD1 for 2.7 on Eclipse 2.1.2 and I’m getting compiler errors for JSP files that are not in my source tree.
My source tree looks like this:
ProjectRoot
|
+ jsp_source
|
+ build_tools
|
+ jsp_templatesIn my project, the project root is “ProjectRoot” and the web root folder is “jsp_source”. When I compile my project, I get the following error:
/work/ProjectRoot/build_tools/jsp_templates/test.jsp) not in base path
I would have assumed that the JSP compiler would only try to compile the files under my web root folder.
dickonMemberOk, I should have previewed this before submitting as the directory tree looks pretty bad. Basically, jsp_source and build_tools are subdirectories off of ProjectRoot, and jsp_templates is a subdirectory off of build_tools. Hope that helps to make things slightly clearer.
support-michaelKeymasterThe present version of ME agressively tries to process all JSPs and assumes that those JSPs outside of the web-root folder are misplaced. The next release will relax this behavior to allow each user to define how JSPs outside of the web-root folder should be interpreted (e.g., OK, warn me, …).
Michael
MyEclipse Support
kivusMemberWhen you say “the next version”, do mean after 2.7 or is it in 2.7?
Also, is there a way to make the web root be the project root?
Riyad KallaMemberkivus: I believe you need to create a new projec to change the root or project name (atleast in my experience).
kivusMemberYeah, I’ve been fighting with that for a bit…
Basically the scenario is that I’ve got my applications directory with 4 or 5 applications in it. So, I was going to set-up projects for each one of those. They all have same structure:
approot (all JSPs)
—-WEB-INF
———classes (all Java files)I want to have my project root and my web root to be the same thing. I can’t seem to get that to work correctly though.
Riyad KallaMemberOh you mean ME doesn’t like you doing that? Have you tried going into the preferences menu for ME and under the webapp setup changing the “Web root” directory (or web source root, i forget the name) to just “/” or leaving it empty? I always prefer having this organization so I don’t notice this:
project + docs <-- java doc, lib docs, licenses, etc. + src <-- servlet, actions, beans, etc. + webroot <-- well, the webroot ;) + resources <-- css, images, hosted content + WEB-INF <-- our friend + classes <-- output for /src dir + lib <-- struts, apis, etc.
So then under web source root in ME setup I set mine to “/webroot”, so maybe setting yours to “/” might work?
kivusMemberYeah, I tried using / and \ for my webroot, but they seem to add Web Root to the project as the path anyway…
When you use the SRC folder do you have ME compile your JSPs to the WEB-INF directory? I’m not sure how to setup for my app server using that structure
Riyad KallaMember1) / not working, Scott can you check into this and maybe add it as a bug?
2) structure question:
Well my JSP pages, actually go into my /webroot directory since the servlet container takes care of compiling them, I treat them as HTML pages, because they are really. I need to worry about editing their layout and using a web page editor on them, etc. Things that are strictly Java source code go into /src and get compiled into WEB-INF/classes.As far as ME compiling the JSPs, AFAIK ME compiles the JSPs merely as a verification step, not to actually preprocess your pages. And it happens to compile them into a .myeclipse hidden directory. When you deploy your web application, the servlet container will compile the JSP pages itself into the same directories they are current in now (index.jsp becomes index_jsp.java, etc.)
So to clarify with some examples:
project + /docs + README.txt + LICENSE.txt + /src + /com + /project + /action + LoginAction.java + LogoffAction.java + SearchAction.java + /servlet + IndexServlet.java + CommServlet.java + MessagingServlet.java + /webroot + index.jsp + login.jsp + search.jsp + /resources + /css + global.css + other.css + /images + login.gif + ok_button.gif + header.gif + /WEB-INF + struts-html.tld + struts-logic.tld + /classes + /com + /project + /action + LoginAction.class + LogoffAction.class + SearchAction.class + /servlet + IndexServlet.class + CommServlet.class + MessagingServlet.class + /lib + struts.jar + commons-*.jar
Properties:
* /src is compiled to /webroot/WEB-INF/classes
* /webroot/WEB-INF/lib is added to class path
* WAR file is created/deployed from the /webroot path as its rootThe benefit with this is that its so clean/organized that you can actually drag and drop the /webroot dir at any time into a servlet container (tomcat) and it will work as is.
What I like to do is edit the context in Tomcat and set the docBase to be my dev dir, so all my changes are immediate in the container and I don’t need to redeploy.
This is just my thing, YMMV especially if you have a more complicated project. I deal primarily in jsp/servlet and jsp/struts projects, no EJB stuff.
kivusMemberMy structure is sort of like that now, except that I have multiple files directories at the webroot level, and the source files are in the web-inf instead of being compiled to there…so I’d have webroot1, webroot2, etc… all with their own JSPs and Java files.
I can’t seem to figure out the best way to setup that structure in ME though. I’ve tried separate web modules for each webroot, but it doesn’t seem to like that…and I’ve tried to set-up one project with the whole enterprise in them but I’m really not sure how to work that, especially since each one of those webroots has their own struts config file.
Riyad KallaMemberoh ok I think I understand you better now… what about doing this:
1) create a new Web Module project for each web module you have
2) make the project directory root the same for every single one, so now you have a bunch of projects that look identical
3) go into each one, right click on root and go to properties, then select MyEclipse-Web properties
4) change the webroot for each one to be the proper subdir you wanted.
5) MyEclipse-struts, and configure the property location of struts-config for each one
6) hit the deployment button, and setup deployment targets for each project.End Result:
each project should be setup to have different web roots from eachother as well as different struts-config files. So now when you deploy, depending on the active project, that module will be deployed to your container.Improvement:
Finding a way to filter PER PROJECT out the directories of the other projects. There is a way to do this in NetBeans and INtelliJ, but the filters in the treeview seem to be for all projects not per project in Eclipse.Did this help at all, or are we still at ground zero?
kivusMemberI’ll give it a shot…
kivusMemberAlright, here’s how this scenario played out:
(1) When I would create a project I would try to use the super directory in the directory structure we mentioned:
super (root)
___+- subDir1 (<= for the webroot)
___+- subrDir2 (<= for the webroot)
___+- subrDir3 (<= for the webroot)I would select the super directory for the project root.
(2) I then went modify the web root so that it would be subDir1. The probelm with this is that all JSPs still in subdir2 and subdir3 are still included in the project…and throw a “file not in base path” compiler error.
Even if I could shut this error off, I’d still run into a problem, addressed in (3)(3) I cannot create multiple projects all pointing to the same directory, I get an error before when initially trying to create the project since it has files already in another project.
The two solutions I see, are:
(I) Allowing the project root to also be the webroot (i.e. / does not get replaced with /Web Root when configuring a project)
or
(II) Allowing the removal of certain files from a project (sort of like the exclusions in the Java classes).
Riyad KallaMemberAhhhh I got you know, that “not in base path” compile error can be a pain. I believe Scott helped someone else with a problem like this; Scott could you hop in here and help Kivus out?
Sorry we couldn’t get this going Kivus, time to call in the big guns!
Riyad KallaMemberOh actually wait, nevermind. Kivus Michael already answered us actually:
The present version of ME agressively tries to process all JSPs and assumes that those JSPs outside of the web-root folder are misplaced. The next release will relax this behavior to allow each user to define how JSPs outside of the web-root folder should be interpreted (e.g., OK, warn me, …).
So it looks like we may need to wait on this.
-
AuthorPosts