Home » Newcomers » Newcomers » Using External Build Structure 
| Using External Build Structure [message #118534] | 
Fri, 18 November 2005 19:27   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: matt.uktrainsim.com 
 
Hi Folks, 
 
I'm very much a newbie when it comes to Eclipse, currently entrenched  
over 'there' with Netbeans for numerous reasons. 
 
I like the look of Eclipse these days, been keeping an eye on it for  
ages and would like to start using it in 'anger' to see how I get on, so  
far stumbled on a major hurdle... 
 
I've developed a build process that is entirely IDE independant for my  
company, using ANT.  Everything is built such that the code can be  
built, tested and run on any platform using the complex ant build  
scripts, the complex interdependencies both on 3rd party jars and 1st  
party projects are all managed by my own property files making it  
extremely easy for me to manage in our environment. 
 
Currently, we can use the Netbeans 'Free Form Project' integration to  
use this set-up and it works quite well, albeit with some limitations it  
is 100% usable, i've built an ant target that will auto generate the  
relevant netbeans 'project.xml' such that all the source files, test  
files etc all show up, relevant buttons and commands (e.g. compile, run,  
debug) all point to the correct ant targets and everything works quite  
well - including integrated IDE debugging and so forth, for both web  
apps and regular apps. 
 
Question is... how to do this in Eclipse... 
 
I should be clear that my initial foray in to Eclipse has been with a 1  
month trial of MyEclipseIDE and i'll be up front and say that even then  
that was only with a couple of days effort, so I'm perfectly happy to be  
told that i've missed something obvious and will apologise if that's the  
case :) 
 
As far as I can see: 
 
I can create an ANT build file based on an Eclipse project. 
I can interpret an ANT build file to create an Eclipse project (though  
it doesn't work without build scripts because of their complexity). 
I can load the ANT build script in and call various targets manually in  
the ANT window. 
 
What I can't seem to do is just get Eclipse to let go of its own project  
structure and/or let me augment where things are. 
 
For example, in the Netbeans project.xml I can say: 
 
"Compile" means run target "compile_debug" 
"Debug" means run target "nb-debug" 
source code can be found in ${project.home}/src 
the following libs are used x.jar;y.jar 
test code is in ${project.home}/test 
web pages are in ${project.home}/web 
 
I don't need the IDE to have a 'live' integration with the ANT  
environment, I'm quite happy to do as I've done with Netbeans and have a  
template driven process that auto-generates the Eclipse projects out of  
the build system, equally if the developer wants to make changes to  
class path and so forth I am comfortable with getting them to alter the  
build system and re-export the config rather than using Eclipse and some  
how expecting that to update the build system automatically.  For  
Netbeans i'm looking at writing a plug-in to manage much of this more  
smoothly since it's obviously quite bespoke, but what it does out of the  
box is perfectly suitable for my team to work. 
 
I guess the core principle of the build system is that *it* rules the  
roost, the IDE's are tools to help write code for the build system to  
manage, build and maintain but ultimately the IDE's are subordinate to  
what's in the build system.  Key reasons for this are that I do not want  
to be locked in to a particular IDE - if I can get Eclipse working it  
means our developers can use either very easily, or both if one suits a  
problem better than the other in one particular instance.  It means that  
I do not have to rely on the IDE for builds, granted Eclipse will  
generate me ANT scripts that do the same job, but our build structure is  
so complex in places that I can see me having to repeat lots of things  
and even then, that still makes me ultimately dependant on Eclipse - I'm  
not currently *dependant* on Netbeans and i'm not about to do anything  
that will create a dependency to some other tool. 
 
Our build system recursively manages and builds all dependent projects  
as well as managing the integration with Subversion etc - really all the  
IDE has got to do is act as a development environment and ask the build  
system to perform tasks as and when. 
 
Now, if it comes down to it, I'll look at writing my own plug-in to  
achieve this - so if that's what's required, any comments or advice on  
such a thing would be much appreciated. 
 
Please redirect any anti-Netbeans flames to /dev/null, consider me a  
current Netbeans user who is using it more out of necessity and  
experience, I don't hold particular allegiances to any IDE, if it does  
the job then it's good enough for me :) 
 
Thanks in advance for any help and advice in helping me get Eclipse in  
to our company. 
 
Matt.
 |  
 |  
  |  
| Re: Using External Build Structure [message #118726 is a reply to message #118534] | 
Mon, 21 November 2005 14:18    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: eclipse3.rizzoweb.com 
 
Matthew Peddlesden wrote: 
> I've developed a build process that is entirely IDE independant for my  
> company, using ANT.  Everything is built such that the code can be  
> built, tested and run on any platform using the complex ant build  
> scripts, the complex interdependencies both on 3rd party jars and 1st  
> party projects are all managed by my own property files making it  
> extremely easy for me to manage in our environment. 
>  
> Currently, we can use the Netbeans 'Free Form Project' integration to  
> use this set-up and it works quite well, albeit with some limitations it  
> is 100% usable, i've built an ant target that will auto generate the  
> relevant netbeans 'project.xml' such that all the source files, test  
> files etc all show up, relevant buttons and commands (e.g. compile, run,  
> debug) all point to the correct ant targets and everything works quite  
> well - including integrated IDE debugging and so forth, for both web  
> apps and regular apps. 
>  
> Question is... how to do this in Eclipse... 
 
[trimmed lots of contextual information] 
 
Eclipse is essentially a generic platform and can be configured to  
operate in nearly endless ways. I have definitely done what I think you  
are after; IOW, a hybrid system where there is an Ant build that is the  
"system of record" for building, but for development Eclipse handles  
some of the chores that the Ant build would do in a non-IDE fashion. 
What Eclipse is very good at out of the box is incremental compilation  
and copying of non-code resources. If you disable it's incremental  
compiler and rely on your own Ant build, you will be losing a lot of the  
value as a Java IDE; I'd recommend against that - it would amount to  
using Eclipse as nothing more than a file navigator, crippled Java-aware  
editor, and Ant launcher. That is not taking full advantage of what it  
has to offer. 
Instead, what I recommend is first going through the Help, specifically  
the Java Development > Getting Started > "Project Config Tutorial" and  
"Basic Tutorial."  That will give you a good idea of the Eclipse  
concepts of Projects and examples of most types of project organization  
structures. Depending on how comfortable you are with the Eclipse UI and  
base (non-Java) feature set, you might also want to go through the  
Workbench User Guide tutorials. 
Once you've got those concepts, I recommend setting up your project in  
Eclipse so that the Eclipse builder builds the Java code and resources  
that are associated with it (properties files, XML, JSPs, etc) into a  
location that your Ant build can share. Depending on how much automation  
you want, you can then either manually invoke your Ant build from  
Eclipse's Ant view, or set it up as a Builder for the project (in which  
case it will get invoked as part of every Eclipse build, which happens  
every time you save a file that is in the source tree - not necessarily  
just Java files, BTW). I usually opt for the former, making sure that  
all "interesting" files that change regularly are included in the  
project configuration as "source" files so they automatically get copied  
to the build output location. 
When set up this way, you can work taking full advantage of Eclipse's  
Java features and still maintain control and use your Ant build as the  
"system of record." If you set up the Eclipse builder to output to the  
right place, the Ant build can leverage the Eclipse-compiled .class  
files (and associated resources) so it does not have to compile/copy  
them again every time. Of course doing a "clean" build with Ant will  
wipe out the Eclipse-compiled classes which is desirable for a release  
or QA build. But on a day-to-day development basis it is very efficient  
to let Eclipse do its part of the build. 
The key to getting this set up correctly is to really understand  
Eclipse's concepts of project organization - many times newbies come on  
this forum with problems and gripes that "Eclipse can't handle my  
existing build or project organization" but it is almost always a case  
of not taking the time to fully understand Eclipse - it is very flexible  
and in more than 3 years and numerous projects I've only ever found one  
type of existing project organization that I could not easily integrate  
into Eclipse's project management and builder. 
 
Of course feel free to post back here with specific questions if  
something continues to elude you. 
 
HTH, 
	Eric
 |  
 |  
  |  
| Re: Using External Build Structure [message #119972 is a reply to message #118726] | 
Sun, 27 November 2005 02:39    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: matt.uktrainsim.com 
 
Thanks for the reply Eric, much appreciated. 
 
I have decided on an approach similar to what you suggest, essentially  
i've abandoned the idea of trying to get the ANT build system to do every  
minute-to-minute task and let it worry about the day-to-day.  I am writing  
a set of "publish" tags that will permit me to export to project files in  
native format for Netbeans and Eclipse (the latter first as it's by far  
the easiest!) such that the IDE can perform its own tasks in the best way  
it knows and the full power of the IDE is available to developers - then  
when a formal build is needed the ant system can be used to create the  
build with no ide-generated code ever leaving a developers machine. 
 
As clever as the Netbeans Freeform system is, I can see me constantly  
chasing a moving target with other developers in the organisation  
frustrated that they can't use the latest whizbang features because either  
FF doesn't support them or I haven't integrated them yet - this way, it  
doesn't matter as long as I can export a valid project file. 
 
Initially, it's still going to need developers to maintain the ant build  
system in terms of dependencies etc, but I have always expected that, what  
I have realised is that a form of import might not be too hard - i.e. read  
classpath and compare with the dependency list in the project within ant  
and then update ant to reflect those changes, thereby permitting  
(potentially) developers to even configure the projects within their  
chosen IDE... that's more a pipe dream at the moment, if I can get it  
working reliably one way that will do for now :) 
 
Thanks again, 
 
Matt.
 |  
 |  
  |   |  
| Re: Using External Build Structure [message #121014 is a reply to message #120507] | 
Wed, 30 November 2005 22:37   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
I'd seen those plug-ins and my intention is to investigate their use in  
exactly this function, very exciting stuff indeed.  The pipe dream is more  
about lack of time to be honest :) 
 
Having just done the publishing of netbeans project files I have to say  
that Eclipse's format is significantly simpler and more effective imho. 
 
Matt.
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:12:01 EST 2025 
 Powered by  FUDForum. Page generated in 0.10397 seconds  
 |