facebook

Does JSP Compilation only use jars for dependencies

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #297163 Reply

    mrfarnham
    Member

    Hi,

    I just installed MyEclipse 7.1 for Eclipse 3.4, on Windows XP Pro.
    I am working on an existing project.
    I originally identified it as a Java project.
    (I have used MyEclipse to modify it as a web project,
    which created another WEB-INF folder, but that is something else.)

    The project in question is dependent on other projects I have open in Eclipse.
    I specify those projects and the .java files all build fine.

    But, the .jsp files still show syntax errors like “Import can’t be found”.
    So, I then added the .jar file for the dependent project in question
    and the syntax errors disappeared.

    So, my question is: “Does JSP compilation only take into account the .jar files specified in the Build Path?”

    I would prefer if JSP compilation (aka validation) would take into account the dependent open projects specified via the Configure Build Path.

    I didn’t list all of my criteria because I figured this is how it worked.

    Thanks,
    Mike

    #297186 Reply

    support-joy
    Member

    Mike,

    I haven’t understood your problem.

    I am working on an existing project.
    I originally identified it as a Java project.
    (I have used MyEclipse to modify it as a web project,
    which created another WEB-INF folder, but that is something else.)

    When you create a web project in MyEclipse, the directory structure includes *src* and *WebRoot*. src contains java source code and WebRoot contains web content and resources.

    The project in question is dependent on other projects I have open in Eclipse.
    I specify those projects and the .java files all build fine.

    How did you include the reference to these other projects? What do you mean by *open in Eclipse*?
    How did you build? How did you deploy your application?
    When you say

    But, the .jsp files still show syntax errors like “Import can’t be found”.
    So, I then added the .jar file for the dependent project in question
    and the syntax errors disappeared.

    Does that mean the java files were not referencing the dependent projects and the reference was present in the .jsps?

    Usually it is like this – If you have a web application lets say, which is dependent on other projects. You need to reference these projects by specifying the reference in the build path. Adding a reference to other projects can by done by following these steps – right click on the project > Properties > Java Build Path > Select Projects > Click on [Add]. This will list all the available projects. Now select the dependent projects and click on [OK]. MyEclipse inturn will create the jar file of the dependent projects and add it to the build path.

    #297252 Reply

    mrfarnham
    Member

    I did add my the other projects to my project using the “project > Properties > Java Build Path > Select Projects > Click on [Add]”

    >>MyEclipse inturn will create the jar file of the dependent projects and add it to the build path.<<
    I am not seeing this happen with the project in question.

    Is there something I have to do to enable this feature of automatically have an Eclipse project be added as a .jar in the build path?

    #297365 Reply

    Loyal Water
    Member

    mrfarnham,
    Can you add the java project as a dependent project. You need to right click on your web project and go to Properties > Project References > and add the Java project there.

    Build your web project again. Does that work?

    #297413 Reply

    mrfarnham
    Member

    I tried adding the project thru the Properties>Project References.
    (I didn’t know about this.)

    I am just using the “Java Builder” to build the project.
    I disabled automatic building.

    I then explicitly built the project.
    I did not see a jar added to the referenced libraries.

    Do I need to using a different builder than the default Java Builder?

    We use Maven to build our projects outside of Eclipse.
    But, we haven’t tried using Maven inside Eclipse.

    #297446 Reply

    Loyal Water
    Member

    1. Yes, we use other projects on the build path to resolve compilation requirements in JSP pages.

    2. It sounds like you might have a configuration issue stopping this from working.

    3. When you added Web Project Capabilities to your project so MyEclipse would see it as a web project, it’s critical that you got both the /src and Web Root directories setup correctly. When you said “It created another WEB-INF dir”, that made me think maybe something didn’t get setup right. MyEclipse uses the “exploded WAR” project layout, and the WEB-INF dir is created directly under the root of the WebRoot directory and that by default the output dir is set to <WEB ROOT>\WEB-INF\classes, and MyEclipse assumes all this stuff. So if you have a wonky project setup that might explain why compilation issues are occurring.

    4. For projects you want to have classes resolved from, you need them under Java Build Path > Projects, as well as in the “Project References” preferences for the project. Also don’t forget to remove the duplicate JARs that you created once you get that setup.

    5. The dependent Java projects must have an assigned output dir in the project, this is where MyEclipse will resolve class references from.

    The example that I have attached should help you out:-

    Attachments:
    You must be logged in to view attached files.
Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Does JSP Compilation only use jars for dependencies

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