facebook

Problem with custom taglib jar referenced via URI

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #202242 Reply

    Dave Johnson
    Member

    My project does not use the standard MyEclipse project structure. I have my web files (*.jsp and WEB-INF/*) in a directory called /web and at build time I stage my complete web application in my build directory /build/war. I’m not able to change this arrangement and I’d like MyEclipse to handle it.

    MyEclipse complains about the JSP files in the stage directory. It says they are not “in the base path.” Apparently, I can ignore these warnings – not a perfect situation, but it works.

    Here is my problem. My project creates some custom JSP tags and uses these tags in JSP pages. These custom tags are packaged into a JAR file that includes a TLD so that I can include my tags in my pages by URI, as shown below:

    <%@ taglib uri=”http://example.com/mytags&#8221; prefix=”mine” %>

    MyEclipse is not happy with this and I cannot use code-completion in my JSP pages unless I include my custom tag jar in the Libraries section of the project build path. But my custom tag jar is created by my build process and placed in my build directory. If I include my jar in my build path, then I cannot do a “build clean” because Eclipse holds a lock on the file and I cannot delete it.

    Can MyEclipse handle custom tags that are defined within a project, packaged as a jar by the project build script, and included on pages via URI?

    What is the recommended workaround for this problem?
    Is a fix for this in the works?

    Thanks,
    – Dave

    #202250 Reply

    Scott Anderson
    Participant

    Dave,

    MyEclipse’s web project structure is modeled after an exploded WAR, as defined by the spec, as does WSAD, JBuilder, etc. As a result, JSP pages need to be placed under a web project’s web root directory. It is only by knowing the project structure that the JSP editor knows where to look for taglibs so that it can parse them and provide code completion.

    In addition, MyEclipse automates the deployment of web projects so that users can develop more effectively without writing Ant scripts. Integration with existing projects is certainly an issue, but since there is no way we can know what kind of other structures developers will choose to use, there is really know way for us to automatically work with them. While we are planning some modifications to make our structure a bit more flexible, it won’t be available for quite awhile so won’t help you in the near term.

    I wish I had a workaround for you, but providing automation via tooling implies knowing the starting point of the project structure and just like all the other IDE’s, we need to know that too.

    #202259 Reply

    Dave Johnson
    Member

    Like I said, I can’t change the project directory structure – it is the corporate standard (used by literally hundreds of developers – think of all those potential customers!) and our automated nightly build scripts are based on it. I’ll keep looking for a workaround. Thanks – Dave

    #202263 Reply

    Riyad Kalla
    Member

    This could be your opportunity to ‘shake things up’ a little at your company. Refactor the whole project and check it into CVS and go home for the day 😀

    #202265 Reply

    support-michael
    Keymaster

    Dave,

    We are looking into a much more flexible web project structure for an upcoming release. It should improve your situation. As others have posted ME works with the exploded WAR folder structure. So if your packaged taglib (jar) is located under your <webroot>/WEB-INF/lib dir then code completion should work properly. We’ll post details soon after we get 2.7/3.7 GA out the door.

    #202271 Reply

    No Operation
    Member

    My project does not use the standard MyEclipse project structure.

    /sigh.

    I have my web files (*.jsp and WEB-INF/*) in a directory called /web

    hmm…

    and at build time I stage my complete web application in my build directory /build/war.

    1. Yes, your structure is NOT fully compatible
    2. Guess any number of users and possible NOT compatible setups. Do you think it is wise to start supporting all those different setups?
    (I know, they only have to support yours, but… you know?)
    3. It is not much work required to make your setup compatible.

    I’m not able to change this arrangement and I’d like MyEclipse to handle it.

    You suffer to the symptoms of mixing development and deplyoment. You NEED changes! (Not only in project structure…)

    A smooth solution might be, to create a new conforming development project which uses filesystem links.

    NOP

    #202301 Reply

    barddzen
    Member

    I have a similiar issue but using a standard URI such as:

    <%@ taglib uri=”/WEB-INF/taglibs-mailer.tld” prefix=”mt” %>

    Generates a stop sign in the JSP editor with the error message:

    “Could not load TLD for URI…” then it lists what it says it couldn’t find.

    The web application works fine but the stop sign is more than a little annoying since there is no real issue.

    The structure we have is thus:

    ROOT WEB
    —-WEB-INF
    ——–taglibs-mailer.tld
    ——–lib
    ————taglibs-mailer.jar

    (The dashes indicate the folder/file structure. I tried spaces but it left-justified everything)
    The web.xml entry for the above is:

    <taglib>
    <taglib-uri>/WEB-INF/taglibs-mailer.tld</taglib-uri>
    <taglib-location>/WEB-INF/lib/taglibs-mailer.jar</taglib-location>
    </taglib>

    Again, the entire application works fine, but the editor seems to have an issue with the taglib reference in the JSP file only.

    #202312 Reply

    Riyad Kalla
    Member

    barddzen,
    Does closing the project and reopning it, restarting eclipse or rebuilding the project help at all? Is this a custom taglib that you are working on, or something from a library?

    Your project structure looks just fine at first sight. Can you provide us with your system setup? (reply and hit Insert)

    #202318 Reply

    No Operation
    Member

    Does the JAR file

    /WEB-INF/lib/taglibs-mailer.jar

    contain the correct TLD file

    /META-INF/taglib.tld

    ?

    NOP

    #202338 Reply

    barddzen
    Member

    I had a few minutes and did a clean install of Eclipse and My Eclipse, imported my project, and still have the same issue. I did this because I had a few other plug-ins and I wanted to make sure of no other conflicts.

    The above issue I mentioned is still there.

    I also did a refresh from the jakarta.apache.org site of the Mailer v1.1 tag-lib, so no, this isn’t one I’m working on…

    When you say “correct” TLD file, I would assume it does since the web application runs just fine and I’ve tested it on Sun ONE AS v7 and Resin v3.x and neither server complains about it nor does the java compiler through Eclipse or Ant (when creating the .war file).

    So, I then reinstalled Eclipse, re-imported the same project, did NOT install My Eclipse and get no stop sign.

    It has to be something in the product that is incorrectly interpreting something with that tag-lib.

    #202351 Reply

    Riyad Kalla
    Member

    Ok, I just created a new project, downloaded the mailer tld from Jakarta and tried it and everything worked fine.

    barddzen, can you create a new simple web project, and add the JAR into the lib dir, the tld into the WEB-INF folder, and make your web.xml file look like this:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <taglib>
            <taglib-uri>/WEB-INF/taglibs-mailer.tld</taglib-uri>
            <taglib-location>/WEB-INF/taglibs-mailer.tld</taglib-location>
        </taglib>
    </web-app>
    

    and see if it works?

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Problem with custom taglib jar referenced via URI

You must be logged in to post in the forum log in