facebook

[Closed] Link Additional Source to Project

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #241926 Reply

    Spent several hours trying to figure out how to configure a project with “Link Additional Source to Project” so that *.sql files are copied to /WEB-INF/classes when running “project deployment”.

    Environment
    Eclipse 3.1.1
    MyEclipseIDE 4.0.3

    Java Project “XYZ” (SQL is in this project):
    Source = XYZ/common/javasource
    Source = XYZ/common/config/sql

    J2EE Web Project “ABC”:
    Source = ABC/webapp/WEB-INF/classes
    Source = ABC/sql (displays due to “link additional source to project”)

    ABC references project XYZ. All class files from XYZ are deployed, but the SQL is not.
    What am I missing? Thanks for the help.

    #241975 Reply

    Riyad Kalla
    Member

    The two source folders you have in project XYZ are going to get compiled into a single output dir, like /bin

    Then in your ABC web project, just make sure it depends on XYZ and set your deployment to Smart Deployment. Then use an exploded deployment and all the output from XYZ is merged into ABC’s output dir, which happens to be WEB-INF/classes

    #242010 Reply

    rkalaa, thanks for the response.

    I did exactly as you described, but the files are not copied to the WEB-INF/classes directory. One point I probably didn’t make clear is:
    the files in the sql directory are*.sql files, not *.java files.

    Each of the source files is configured:
    Inluded: (All)
    Excluded: (None)

    Will the IDE only deploy “compiled” class files? Or can it deploy any type of file? I have ABC dependant on XYZ, and have the Smart Deployment radio button selected. Also, using exploded deployment option.

    Looking forward to your reply.

    #242018 Reply

    Riyad Kalla
    Member

    the files in the sql directory are*.sql files, not *.java files.

    That’s OK, as long as this folder is marked as a “Source” folder, Eclipse “compiles” them by copying them directly into the output dir. This is the same way it handles properties files.

    Will the IDE only deploy “compiled” class files? Or can it deploy any type of file?

    It will support any type.

    Doug,
    Just to make sure things are suppose to work as is, I create 2 new projects:
    TestJava (Java Project that uses separate /src and /bin dirs for compiling)
    TestWeb (Web Project)

    I create a package, com.test in TestJava, and add 3 files: one.sql, two.sql, three.sql

    Then I went to TestWeb, editing the project properties and added TestJava to the Build Path and marked it on the Project References section as well. I then made just to set my global deployment setting to Smart and maed sure my prjoect wasn’t overriding that setting.

    Then I created an exploded deployment to Tomcat, and bam, all the files were there, merged into the /classes directory.

    #242029 Reply

    TestJava (Java Project that uses separate /src and /bin dirs for compiling)

    Maybe the problem is using the same directories for “src” and “bin”? I have:

    Source folders on build path:
    TestJava/DocServices/javasource
    TestJava/DocServices/common/config/sql
    TestJava/DocServices/common/config/xml

    Default output folder:
    TestJava/DocServices/javasource

    Then I went to TestWeb, editing the project properties and added TestJava to the Build Path

    Same.

    and marked it on the Project References section as well.

    Same.

    I then made just to set my global deployment setting to Smart

    Same.

    and made sure my prjoect wasn’t overriding that setting.

    Same.

    BTW, I tried referencing the sql & xml directories in Java Build Path > Libraries… that didn’t work either.

    #242032 Reply

    Riyad Kalla
    Member

    Try changing your TestJava project to output to TestJava/bin directory, that might be it.

    #242349 Reply

    Yep, you were right. Changing output worked. Thanks rkalla.

    #242350 Reply

    Riyad Kalla
    Member

    Glad it is working now.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: [Closed] Link Additional Source to Project

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