Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Best Practice: Custom Publishing
Best Practice: Custom Publishing [message #198936] Thu, 23 August 2007 20:55 Go to next message
Eclipse UserFriend
Originally posted by: stevewickii.hotmail.com

Question: What is the most straight forward way to configure a Project in
Eclipse that contains multiple web applications, that then can be deployed
and tested on a Tomcat 5.5 Server, with webapps or WAR files produced by an
Ant script, and it retains the Debugging functionality in Eclipse?

I am using Eclipse 3.2 (just downloaded 3.3 though)

I have a Project that is layed out like this:
/build/build.xml
/build/webapp1.build.properties <-- Used by Ant when filtering files that
contain Ant Tokens
/build/webapp2.build.properties <-- Used by Ant when filtering files that
contain Ant Tokens
/src/java/com/domain/client/webapp1/JavaClass1.java
/src/java/com/domain/client/webapp1/JavaClass2.java <--Contains Ant
Tokens (Author, Version)
/src/java/com/domain/client/common/JavaClass3.java
/src/java/com/domain/client/webapp2/JavaClass4.java
/webapps/webapp1/WEB-INF/web.xml <-Contains Ant Tokens
/webapps/webapp1/WEB-INF/properties/log4j.properties <-Contains Ant
Tokens
/webapps/webapp1/WEB-INF/properties/jdbc.properties <-Contains Ant Tokens
/webapps/webapp1/index.jsp
/webapps/webapp1/page1.jsp
/webapps/webapp2/WEB-INF/web.xml <-Contains Ant Tokens
/webapps/webapp2/WEB-INF/properties/log4j.properties <-Contains Ant
Tokens
/webapps/webapp2/WEB-INF/properties/jdbc.properties <-Contains Ant Tokens
/webapps/webapp2/index.jsp
/webapps/webapp2/page1.jsp

I want all /src/java files to be available to both webapps, so that reuse is
quick and easy.

I cannot set up an Eclipse "Server" (Tomcat 5.5) to serve each webapp
(webapp1 and webapp2) directly from the /webapps/webapp1 and 2 folders,
because several files need to be filtered by the Ant build.xml before they
are deployed to the application server.

Is there a recommendation for this kind of project layout?
Re: Best Practice: Custom Publishing [message #198944 is a reply to message #198936] Thu, 23 August 2007 21:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

You can configure eclipse to run ant scripts as part of the project
build. To do that, go to the Project Properties > Builders > New > Ant
Builder. You can configure the script to run, what kind of parameters to
pass in, environment, etc. If the ant script modifies project resources,
make sure to specify which resources will be modified so that they can
be refreshed in your workspace. If you don't know (or don't want to
enumerate), you can tell it to refresh the entire project.

Hope this helps,

- Konstantin
Re: Best Practice: Custom Publishing [message #198953 is a reply to message #198944] Thu, 23 August 2007 22:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stevewickii.hotmail.com

Thank you for the suggestion Konstantine!

I have tried this, and I have a few problems.

1. When Eclipse builds the project, it doesn't display source code errors
within the views and source code. (it appears to be unable to identify
source code errors without executing the internal Java Builder)
2. It doesn't solve the problem with integrating an Eclipse "Server" with
the produced webapp or WAR file, so that I can debug code using the Eclipse
debugger.

I would like to see a "Server" component capable of executing an Ant task
for "publishing" the webapp to the application server.

I may be able to configure the "Server" in Eclipse 3.3 to host out of a
custom CATALINA_BASE, and the Ant build file to produce a war file under the
CATALINA_BASE/webapps folder. But then the controls for Publishing, Adding
and Removing a Web Module are lost.

It would be nice if a Web Module, which can be deployed to a Server, could
be tied to an Ant task for publishing to a Server configured in Eclipse.
That way all of the Server buttons would continue to function (Start, Stop,
Restart, Publish, etc..).

It would also be nice if Eclipse would support clustered Servers. I know I
can set up two Tomcat Servers outside of Eclipse, and write an ant script to
publish to the servers, but I lose the ability to use the Server components
in Eclipse, and to Debug the Tomcat Servers (set breakpoints and walk
through the source code).

What are your thoughts? Is anyone working on enhancements like these?

"Konstantin Komissarchik" <kosta@bea.com> wrote in message
news:faktkp$jo6$1@build.eclipse.org...
> You can configure eclipse to run ant scripts as part of the project build.
> To do that, go to the Project Properties > Builders > New > Ant Builder.
> You can configure the script to run, what kind of parameters to pass in,
> environment, etc. If the ant script modifies project resources, make sure
> to specify which resources will be modified so that they can be refreshed
> in your workspace. If you don't know (or don't want to enumerate), you can
> tell it to refresh the entire project.
>
> Hope this helps,
>
> - Konstantin
Re: Best Practice: Custom Publishing [message #198960 is a reply to message #198953] Thu, 23 August 2007 22:38 Go to previous message
Eclipse UserFriend
Originally posted by: kosta.bea.com

As you've noted there is currently no way for the user to extend the set
of actions that happen during publish. However, you should be able to
get the necessary processing to happen at build time instead and not
loose any of the Eclipse functions.

I would recommend augmenting rather than replacing the existing
builders. As you've noted, you do not want to disable the Java Builder,
but you can add some ant logic to run before the java builder that can
pre-process the .java files. You can play a lot of tricks using this
approach. For instance, I have projects where there is an ant
pre-processor that creates .java files in a designated directory within
the project. That directory is configured to be a java source directory,
so when the ant pre-processor completes, the Java Builder will compile
the generated .java files.

Hope this helps.

- Konstantin
Previous Topic:WSDL code generation weirdness
Next Topic:Dependent projects
Goto Forum:
  


Current Time: Thu Apr 25 18:49:20 GMT 2024

Powered by FUDForum. Page generated in 0.03032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top