- This topic has 4 replies, 2 voices, and was last updated 18 years, 10 months ago by
hurffwebb.
-
AuthorPosts
-
hurffwebbMemberI have an application consisting of:
1) EAR Project
2) Web Project
3) EJB ProjectMy EJB classes need to have access to the classes I have in my Web project. I see the option in the EJB Build properties to merge classes from Referenced “Java Projects”, but how can I merge my class files from my Web Project into my EJB JAR file?
Better yet, how can I jar the classes in my Web project and put them in the root level of my EAR to be accessed by all components of my EAR?
I notice both options I need are available for Java Projects only, but why not Web Project source? Can someone please clarify?
Thanks in advance.
Riyad KallaMemberdwebb,
You are correct, common code should belong in a top level Java Project that can be marked as a depdendency of all the projects that need it.As to your 2nd question, check Section 9 here: http://myeclipseide.com/enterpriseworkbench/help/index.jsp?topic=/com.genuitec.myeclipse.doc/html/quickstarts/earprojects/index.html
hurffwebbMemberOK, I am in agreement with you on how the classes should be structured, stored in different projects, and packaged together. If I take that path, which I would like to take, here is my delimma:
For each logical Use Case I have the following package structure:
/usecase/action - Contains Struts Actions /usecase/dao - Data Access /usecase/manager - Connection/Business Logic Management /usecase/form - Struts Action Forms /usecase/model - Value Objects
I tried to keep my struts specific packages in the Web project, and move the others to a common Java Project. While this seems ideal, the problem that I run into is that the classes in /model reference classes in /form and vice versa. If I tell Eclipse that the Web project references the Common Java Project and that the Common Java Project references the Web project, I get a cyclical build error message.
I understand the cyclical reference, but I dont understand how else I can split classes out into 2 separate projects that reference each other. Any Suggestions? Thanks for you help!!!
Riyad KallaMemberHmm, honestly I would be tempted to tell you not to move the /model classes out of the web project. Typically value objects are used in the web tier to represent and transfer data between the database and the web portion of your app and visa versa… because of this I think it’s fine if you kept those items in your web… but, if you are using them in your EJB project as well, I can understand why this would get tricky and/or feel strange to do.
Is your EJB project using the value objects?
hurffwebbMemberMy Web and EJB Project use classes from /model and /manager.
-
AuthorPosts