Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » include dynamic web project in another dynamic web project(cannot include a DWP in another DWP)
include dynamic web project in another dynamic web project [message #505835] Tue, 05 January 2010 05:10 Go to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
I have a dynamic web project (DWP) which has some generic filters, servlets and listeners. This project is a DWP because it contains test situations; it's configured in a Tomcat server and I can do run through some test scenario's.

Naturally I want to use this in a real life DWP, so I want to include the "utility DWP" project, but Eclipse doesn't show it in the JEE module dependencies; only non-DWP projects are listed.

I assume it is on purpose, but I think my scenario is not that strange. Is there a away around?
Re: include dynamic web project in another dynamic web project [message #506193 is a reply to message #505835] Wed, 06 January 2010 09:04 Go to previous messageGo to next message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
I am not positive I have a grasp on your situation but this is what I think it is.

You have a set of java classes that both your Testing DWP and your "real life" DWP need access too.

If this is a case then you should create a Utility project using the "File -> New -> Utility Project" wizard and move the shared classes to that project. Then both of your DWPs can add the utility project as a JEE module dependency.

If I am not understanding your situation correctly please clarify.


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Re: include dynamic web project in another dynamic web project [message #506434 is a reply to message #506193] Thu, 07 January 2010 09:16 Go to previous messageGo to next message
Mauro Molinari is currently offline Mauro Molinari
Messages: 278
Registered: July 2009
Senior Member
Ian Tewksbury ha scritto:
> If this is a case then you should create a Utility project using the
> "File -> New -> Utility Project" wizard and move the shared classes to
> that project. Then both of your DWPs can add the utility project as a
> JEE module dependency.

I didn't even know "Utility Project" existed. I usually create a Java
Project that then I add as a JEE module dependency to the Dynamic Web
Project.

However, I agree with Tom that sometimes having support for such a
dependency mechanism even for web application resources (JSPs, static
documents, etc.) would be useful, but AFAIK it's not possibile yet.

However, I know there's some work in progress in this area, isn't it?

Mauro.
Re: include dynamic web project in another dynamic web project [message #506449 is a reply to message #506193] Thu, 07 January 2010 10:04 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
The "testing DWP" IS the utility project. It contains servlets and filters and naturally test code (hence it is a DWP project).

I could separate the test classes into a separate DWP, that would work. But I'd prefer keeping source + test in one.

Re: include dynamic web project in another dynamic web project [message #506459 is a reply to message #506449] Thu, 07 January 2010 10:26 Go to previous messageGo to next message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
Tom Eugelink wrote on Thu, 07 January 2010 10:04
I could separate the test classes into a separate DWP, that would work. But I'd prefer keeping source + test in one.

What are the shared resources here that need to be accessed by both DWP. Is it Java classes, or Servlets or a combination of both?

While I am still not clear on the situation one thing you could try is to add the "utility DWP" as a class path dependency of the production DWP. To do this you would:
1. right click on the production DWP and selection "Properties" 2. then select "Java Build Path"
3. then select the "Projects" tab
4. Then click "Add..." and select the your utility DWP

I am not positive this will buy you what you are looking for and you would still have to deploy each DWP separately unless they are both contain din the same EAR then you could just deploy the EAR.

The relationship that needs to be formed between the projects and weather a separate "Utility Project" would be useful here really depends what type of resources you are trying to reference in your utility DWP and how you are referencing them.


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Re: include dynamic web project in another dynamic web project [message #506487 is a reply to message #506459] Thu, 07 January 2010 11:56 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
The DWP tools project contains servlets and filters.

The problem is not in that they don't compile, they do fine, but that I cannot place them on the JEE module dependencies for the Tomcat server that is running inside Eclipse. Then It won't find the classes when they are specified in web.xml.
Re: include dynamic web project in another dynamic web project [message #506869 is a reply to message #506487] Mon, 11 January 2010 03:44 Go to previous messageGo to next message
Mauro Molinari is currently offline Mauro Molinari
Messages: 278
Registered: July 2009
Senior Member
Tom Eugelink ha scritto:
> The DWP tools project contains servlets and filters.
>
> The problem is not in that they don't compile, they do fine, but that I
> cannot place them on the JEE module dependencies for the Tomcat server
> that is running inside Eclipse. Then It won't find the classes when they
> are specified in web.xml.
>

But, if the DWP tools project just contains servlets and filters, why
don't you follow Ian's first advice? If you set it as a "Utility
project" instead of a "Dynamic Web Project", it will still compile
(cause the Utility project is bound to a server runtime) and it will be
available for the production DWP to be used as a JEE module dependency...

Am I missing something?

Mauro.
Re: include dynamic web project in another dynamic web project [message #506870 is a reply to message #506487] Mon, 11 January 2010 03:46 Go to previous messageGo to next message
Mauro Molinari is currently offline Mauro Molinari
Messages: 278
Registered: July 2009
Senior Member
Tom Eugelink ha scritto:
> The DWP tools project contains servlets and filters.
>
> The problem is not in that they don't compile, they do fine, but that I
> cannot place them on the JEE module dependencies for the Tomcat server
> that is running inside Eclipse. Then It won't find the classes when they
> are specified in web.xml.

An alternative would be this: if you don't want the DWP tools project to
be a "Utility project" (for any reason), you can set is as a Java
project and manually add to it the Server runtime (Tomcat or such...)
Java library. Then, you'll be able to add it as a JEE module dependency
to the production DWP.

Mauro.
Re: include dynamic web project in another dynamic web project [message #506885 is a reply to message #506869] Mon, 11 January 2010 04:21 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
The generic DWP contains a test environment testing the servlets and filters, so it is configured as a DWP in the server itself.
The actual project uses the generic servlets, and naturally is configured as a DWP project in the server.

The setup is not that strange, is it? It's like you're building a JAR project and have a utility JAR project it depends on. The utility JAR project has its own test environment.

I can work around this problem; just build the JAR with the servlets and include that in the other project. But then I do not have the flexible EDI setup I hoped.

[Updated on: Mon, 11 January 2010 04:23]

Report message to a moderator

Re: include dynamic web project in another dynamic web project [message #507109 is a reply to message #506885] Mon, 11 January 2010 22:42 Go to previous messageGo to next message
Mauro Molinari is currently offline Mauro Molinari
Messages: 278
Registered: July 2009
Senior Member
Tom Eugelink ha scritto:
> The generic DWP contains a test environment testing the servlets and
> filters, so it is configured as a DWP in the server itself. The actual
> project uses the generic servlets, and naturally is configured as a DWP
> project in the server.
>
> The setup is not that strange, is it? It's like you're building a JAR
> project and have a utility JAR project it depends on. The utility JAR
> project has its own test environment.

I still can't understand what's your problem.

If your problem is "how can I set the dependency", the solution is "set
up the generic project as a Utility project" (if that wouldn't work
please explain why). Then, you will be able to set it as a JEE module
dependency for your actual project, so that a JAR of the utility project
will be automatically built by Eclipse and deployed to WEB-INF/lib
folder of your actual project. The existance of a test environment in
the utility project shouldn't be a problem for that. If it is, please
explain why (and define what's your test environment... test classes? A
web application?).

If your problem is "I want to add a DWP as a JEE module dependency for
another DWP", the answer is: as of now, you can't. But it's still not
clear why you want the generic project to be a DWP at all costs.

I think the solution to your problem exists, but it may not be yours.

Mauro.
Re: include dynamic web project in another dynamic web project [message #507117 is a reply to message #507109] Tue, 12 January 2010 04:17 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
I do not really know how to better explain it:

Utility DWP:
- java source code of generic servlets and filters
- web environment for testing; configfiles, jsps, etc.

Actual DWP:
- java source code of application code
- includes utility DWP to use generic servlets and filters
- web environment with application config files, jsps, additional servlets, etc, etc

Just like you would a normal application and utility JAR. I think this is not illogical.

I have the answer I was looking for (no, it can't be included). I already have a workaround. So we can leave it at that. I just wanted to know if it was possible.

Everybody thanks for the effort.
Re: include dynamic web project in another dynamic web project [message #507198 is a reply to message #507117] Tue, 12 January 2010 08:16 Go to previous messageGo to next message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
Tom,

Now that I clearly see your situation, it seems perfect for the use of a Utility Project that I explained earlier.

You ccould then set it up this way:

Utility Project:
- java source code of generic servlets and filters

Testing DWP:
- web environment for testing; configfiles, jsps, etc.
- JEE Module Dependency of the "Utility Project"

Actual DWP:
- java source code of application code
- web environment with application config files, jsps, additional servlets, etc, etc
- JEE Module Dependency of the "Utility Project"

In this way the Java source code in the "Utility Project" is accessibly from both your Testing and Actual DWPs and you are able to create the neccissary JEE Module Dependencies.

But as you said in the beginning there is no way to have a JEE Module Dependency on a DWP from a DWP. Not working in that area I do not know the reasons why but you could always search for an open Bugzilla request for this feature or open your own if you can not find one. Though I think the solution I described above is the expected practice.

Blue Skies,

~Ian


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Re: include dynamic web project in another dynamic web project [message #507213 is a reply to message #507198] Tue, 12 January 2010 09:25 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
Well... Common practice is to include any test environment in the same project. For example: Maven supports a source folder for test and regular sources.

In parallel it would be logical to include the test web stuff for a utility DWP in the same project, and not setup a separate project only for testing.

But your suggestion is a valid workaround.
Re: include dynamic web project in another dynamic web project [message #507375 is a reply to message #507198] Wed, 13 January 2010 04:18 Go to previous message
Mauro Molinari is currently offline Mauro Molinari
Messages: 278
Registered: July 2009
Senior Member
This is now clear for me too. And Ian could not explain it better.

Ian Tewksbury ha scritto:
> But as you said in the beginning there is no way to have a JEE Module
> Dependency on a DWP from a DWP. Not working in that area I do not know
> the reasons why but you could always search for an open Bugzilla request
> for this feature or open your own if you can not find one. Though I
> think the solution I described above is the expected practice.

This is the request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=107039
Tom, you could monitor that bug and add your vote.

I was wrong, there's not current work on this, I got confused about the
in-progress work for e4 for low-level resource mapping.

Mauro.
Previous Topic:ECore to WSDL?
Next Topic:Failed while installing Dynamic Web Module 2.5
Goto Forum:
  


Current Time: Mon Sep 01 03:45:02 EDT 2014

Powered by FUDForum. Page generated in 0.03972 seconds