Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » project dpendency
project dpendency [message #167584] Wed, 26 April 2006 06:02 Go to next message
Zohar Amir is currently offline Zohar Amir
Messages: 419
Registered: July 2009
Senior Member
Hello,
Why is adding a project dependency for a WTP project (J2EE Module
Dependencies) different than for a normal java project (Build Path ->
Projects)?
Re: project dpendency [message #167608 is a reply to message #167584] Wed, 26 April 2006 12:14 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
Java development in Eclipse is supported by JDT. JDT knows how to run
Java applications. However, Web application != Java application. Web
applications are "hosted" in a servlet container, which JDT currently
knows little if anything about. Therefore, changing JDT's build path
only affects building. To add a JAR to the build path and have it
available to the Web application at runtime, you have to use J2EE Module
Dependencies. The "J2EE" implies it knows how to handle Web applications.

Note that if the servlet container supplies classes or JARs that don't
appear in the Dynamic Web Project's target runtime, such as having JARs
in Tomcat's "shared/lib", you would want to only modify the build path.
It would be nice if when you add a JAR to the build path, something
could ask or allow you to indicate if it should also go into the Web
application's WEB-INF/lib. I'm not sure if the APIs in JDT are
currently sufficient to allow this to be implemented in a way the Web
Tools can build upon. Maybe someday.

Cheers,
Larry

Zohar wrote:
> Hello,
> Why is adding a project dependency for a WTP project (J2EE Module
> Dependencies) different than for a normal java project (Build Path ->
> Projects)?
>
>
Re: project dpendency [message #167617 is a reply to message #167608] Wed, 26 April 2006 12:41 Go to previous messageGo to next message
Zohar Amir is currently offline Zohar Amir
Messages: 419
Registered: July 2009
Senior Member
Thank you. Great answers as always.

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:e2no84$jj2$1@utils.eclipse.org...
> Java development in Eclipse is supported by JDT. JDT knows how to run
> Java applications. However, Web application != Java application. Web
> applications are "hosted" in a servlet container, which JDT currently
> knows little if anything about. Therefore, changing JDT's build path only
> affects building. To add a JAR to the build path and have it available to
> the Web application at runtime, you have to use J2EE Module Dependencies.
> The "J2EE" implies it knows how to handle Web applications.
>
> Note that if the servlet container supplies classes or JARs that don't
> appear in the Dynamic Web Project's target runtime, such as having JARs in
> Tomcat's "shared/lib", you would want to only modify the build path.
> It would be nice if when you add a JAR to the build path, something could
> ask or allow you to indicate if it should also go into the Web
> application's WEB-INF/lib. I'm not sure if the APIs in JDT are currently
> sufficient to allow this to be implemented in a way the Web Tools can
> build upon. Maybe someday.
>
> Cheers,
> Larry
>
> Zohar wrote:
>> Hello,
>> Why is adding a project dependency for a WTP project (J2EE Module
>> Dependencies) different than for a normal java project (Build Path ->
>> Projects)?
>>
Re: project dpendency [message #168473 is a reply to message #167608] Thu, 04 May 2006 06:51 Go to previous messageGo to next message
Zohar Amir is currently offline Zohar Amir
Messages: 419
Registered: July 2009
Senior Member
What if my web module (WM) depends on a java project (JP1), which depends on
another java project (JP2)? When exporting to WAR, do I get JP1's classes
and JP2's classes in my WEB-INF/lib dir?

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:e2no84$jj2$1@utils.eclipse.org...
> Java development in Eclipse is supported by JDT. JDT knows how to run
> Java applications. However, Web application != Java application. Web
> applications are "hosted" in a servlet container, which JDT currently
> knows little if anything about. Therefore, changing JDT's build path only
> affects building. To add a JAR to the build path and have it available to
> the Web application at runtime, you have to use J2EE Module Dependencies.
> The "J2EE" implies it knows how to handle Web applications.
>
> Note that if the servlet container supplies classes or JARs that don't
> appear in the Dynamic Web Project's target runtime, such as having JARs in
> Tomcat's "shared/lib", you would want to only modify the build path.
> It would be nice if when you add a JAR to the build path, something could
> ask or allow you to indicate if it should also go into the Web
> application's WEB-INF/lib. I'm not sure if the APIs in JDT are currently
> sufficient to allow this to be implemented in a way the Web Tools can
> build upon. Maybe someday.
>
> Cheers,
> Larry
>
> Zohar wrote:
>> Hello,
>> Why is adding a project dependency for a WTP project (J2EE Module
>> Dependencies) different than for a normal java project (Build Path ->
>> Projects)?
>>
Re: project dpendency [message #168495 is a reply to message #168473] Thu, 04 May 2006 13:18 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
If JP1 has a build time dependency, then that dependency has to be
accounted for in WM at runtime. If the build time dependency is
something that will be made available at runtime by default, then WM
doesn't need to change. In your example, it seems likely that this
won't be the case. Thus, to address the runtime dependency, you will
need to add JP2 to the J2EE Module Dependencies of WM so both will be
added to WEB-INF/lib as JARs.

Note that currently, the JARs created in this fashion include all of the
contents of the utility project, including Java source. I'll have to see
what might be done to improve this. If it matters, you may want to use
File -> "Export..." -> "JAR file" to create "official" versions of these
JARs before deploying to a production site.

Cheers,
Larry

Zohar wrote:
> What if my web module (WM) depends on a java project (JP1), which depends on
> another java project (JP2)? When exporting to WAR, do I get JP1's classes
> and JP2's classes in my WEB-INF/lib dir?
>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:e2no84$jj2$1@utils.eclipse.org...
>> Java development in Eclipse is supported by JDT. JDT knows how to run
>> Java applications. However, Web application != Java application. Web
>> applications are "hosted" in a servlet container, which JDT currently
>> knows little if anything about. Therefore, changing JDT's build path only
>> affects building. To add a JAR to the build path and have it available to
>> the Web application at runtime, you have to use J2EE Module Dependencies.
>> The "J2EE" implies it knows how to handle Web applications.
>>
>> Note that if the servlet container supplies classes or JARs that don't
>> appear in the Dynamic Web Project's target runtime, such as having JARs in
>> Tomcat's "shared/lib", you would want to only modify the build path.
>> It would be nice if when you add a JAR to the build path, something could
>> ask or allow you to indicate if it should also go into the Web
>> application's WEB-INF/lib. I'm not sure if the APIs in JDT are currently
>> sufficient to allow this to be implemented in a way the Web Tools can
>> build upon. Maybe someday.
>>
>> Cheers,
>> Larry
>>
>> Zohar wrote:
>>> Hello,
>>> Why is adding a project dependency for a WTP project (J2EE Module
>>> Dependencies) different than for a normal java project (Build Path ->
>>> Projects)?
>>>
>
Re: project dpendency [message #168535 is a reply to message #168495] Thu, 04 May 2006 17:00 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
I need to correct the statement below about the utility JARs being
created with all of the project's contents. I see this when I'm running
debug sessions in my build environment, i.e. I have an Eclipse with WTP
source checked out into my workspace and I'm running a debug session of
Eclipse+WTP using this source.. I'm not seeing this behavior with
installed versions of WTP, where just the class files are included.

While I don't have an explanation for the difference, I have seen other
differences between debugging sessions and installed sessions. I'll
have to remember to check such things when uncovered in a debug session.
Sorry if I alarmed anybody.

Cheers,
Larry

Larry Isaacs wrote:
> If JP1 has a build time dependency, then that dependency has to be
> accounted for in WM at runtime. If the build time dependency is
> something that will be made available at runtime by default, then WM
> doesn't need to change. In your example, it seems likely that this
> won't be the case. Thus, to address the runtime dependency, you will
> need to add JP2 to the J2EE Module Dependencies of WM so both will be
> added to WEB-INF/lib as JARs.
>
> Note that currently, the JARs created in this fashion include all of the
> contents of the utility project, including Java source. I'll have to see
> what might be done to improve this. If it matters, you may want to use
> File -> "Export..." -> "JAR file" to create "official" versions of these
> JARs before deploying to a production site.
>
> Cheers,
> Larry
>
> Zohar wrote:
>> What if my web module (WM) depends on a java project (JP1), which
>> depends on another java project (JP2)? When exporting to WAR, do I get
>> JP1's classes and JP2's classes in my WEB-INF/lib dir?
>>
>> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
>> news:e2no84$jj2$1@utils.eclipse.org...
>>> Java development in Eclipse is supported by JDT. JDT knows how to
>>> run Java applications. However, Web application != Java
>>> application. Web applications are "hosted" in a servlet container,
>>> which JDT currently knows little if anything about. Therefore,
>>> changing JDT's build path only affects building. To add a JAR to the
>>> build path and have it available to the Web application at runtime,
>>> you have to use J2EE Module Dependencies. The "J2EE" implies it knows
>>> how to handle Web applications.
>>>
>>> Note that if the servlet container supplies classes or JARs that
>>> don't appear in the Dynamic Web Project's target runtime, such as
>>> having JARs in Tomcat's "shared/lib", you would want to only modify
>>> the build path.
>>> It would be nice if when you add a JAR to the build path, something
>>> could ask or allow you to indicate if it should also go into the Web
>>> application's WEB-INF/lib. I'm not sure if the APIs in JDT are
>>> currently sufficient to allow this to be implemented in a way the Web
>>> Tools can build upon. Maybe someday.
>>>
>>> Cheers,
>>> Larry
>>>
>>> Zohar wrote:
>>>> Hello,
>>>> Why is adding a project dependency for a WTP project (J2EE Module
>>>> Dependencies) different than for a normal java project (Build Path
>>>> -> Projects)?
>>>>
>>
Previous Topic:Web project can't see .jar in dependent project
Next Topic:jBoss org.xml.sax.SAXException: No deserializer for [...]
Goto Forum:
  


Current Time: Wed Sep 03 02:31:30 GMT 2014

Powered by FUDForum. Page generated in 0.02111 seconds