Is there any way to have an Ant script running in Eclipse publish a WTP project? I want my ant script to perform some tasks, then kick off the publish as if I had done it from the UI, and then do some more things.
Don't know how far you got with this. But if you create your own ant script, and put
at the top, your script will get imported in the the WTP generated ant script. That said, all i've gotten it to do is add the targets, I haven't quite figured out the "hooking in" to existing behaviour yet.
If you did find anything interesting, post it, as I'm looking for more info on integrating WTP with existing builds.
Related
I have written a couple of Ant tasks in Eclipse that may be of use to more people, and am looking for a way to make them easily distributable. Creating an Eclipse plugin that provides these Ant tasks is the first thing that came to mind, but I'm not quite sure how to do this.
Are there any good tutorials out there on how to create an Eclipse plugin that provides only a couple of Ant targets?
How do I build and install an Eclipse plugin using ant? I want to build a plugin as a zip file and then install the plugin on 32bit or 64bit eclipse. What am I supposed to do here?
Indeed, using PDE/Build to achieve a so-called headless build is difficult, but not impossible.
We are still building our RCP this way.
I recommend reading Paulin's and Sharma's tutorials on the issue.
The Eclipse PDE has its own builder which is built on ant. I'm not sure from your question if you are looking to simply build/export your plugin within eclipse or generate ant build scripts that can be run outside of eclipse. The latter is more difficult. Inside eclipse you can simple go to file -> export -> Plugin-Development -> Deployable plugin and the export wizard will walk you through it, you can select to deploy a zip or exploded directory and then select output location and presto you have your plugin built as a jar that can be dropped into an eclipse instance. If you are looking to use ant outside of eclipse to build you need to go through a series of steps that are complicated to get a 'headless build", if this is what you need to do Google "pde headless" build. I've tried it but gave up. There is also a good book "Building highly modular systems with OSGI/Equinox that has a chapter devoted to this. - Duncan
I have a requirement where the individual modules are built using ant and the resulting jars should be used by eclipse to package the ear and publish on JBoss server.
I wrote ant script that builds the dependency modules and puts under project/build/artifact directory. And used the jars under this directory to provide Java EE module dependencies.
The packing seems to work fine if the dependencies were added after the modules were already generated. But when another developer takes my changes and tries to get this working, the dependency modules are not recognized because the modules were not created yet.
After building the modules and refreshing the project workspace, the modules be recognized and added to the ear. But the module dependencies were not shown until I pretended to modify the component file (added a new line or a space and saved it - not really modifying the content) and did a project refresh and it worked. I searched on eclipse to see if this is an existing bug, but didn't find any relating bugs.
Am I doing something wrong here? Is this approach the right approach to get the modules built by ant and use them in packaging an ear and publish it using eclipse? Please help.
This is likely a bug in WTP, but..
I would keep Ant and Eclipse builds away from each other. Use your Ant script to produce your "official" builds for production. During development do not try to feed result of Ant build into Eclipse build. Do this with direct project-to-project Java EE module dependencies instead.
The only time that it is really necessary to get Ant involved in the Eclipse build is when you need to integrated external compilers or code generators into the build process.
I believe when Eclipse installs, ant comes with it.
I should review the default build.xml
( I assume it uses one, whether or not it is obviously included in the project files )
I need to find out where it would store and use this from.
I have some projects / code artifacts that come with a build spec, and may need to use the one specified. Thanks in advance for your help, and suggestions.
Eclipse doesn't use ant to build your projects, if that's what you are asking. Eclipse builders (such as Java builder) are implemented natively as Eclipse plugins. Eclipse does support integration with Ant... Calling ant targets as part of the build... Calling ant targets as separate tools... Ant is meant to be used to augment IDE-provided facilities when you need something specialized.
I'd be interested to find out about any automated processes that people have for ensuring that the project classpaths for the ant and eclipse configurations are in synch. In my case, I want the classpath defined in the ant build file to be the master configuration, since its used for our production builds. As part of the build i'd like to add an ant target that will verify that the eclipse classpath is up to date, or at least indicate differences between the two classpaths.
I'm aware of ant4eclipse but its focus is in the opposite direction, ensuring that the eclipse classpath is master and that the ant build reuses the eclipse path. I like the idea behind AntAndEclipse but am wondering are their ant other tools in this space that i'm not aware of.
You solution at a previous company was to have ant invoke Eclipse to do the compiles as described here:
http://www.eclipse.org/articles/Article-PDE-Automation/automation.html
I'm not aware of any ant tools which can do this but I've switched from ant to Maven a few years ago and never looked back. You can use the "Maven integration for Eclipse" to make Eclipse use the Maven classpath.
As of today, I'm not 100% happy with the Eclipse plugin, though. It's a bit slow and due to the different philosophy of Eclipse and Maven, some operations behave strange. For example, Eclipse doesn't differentiate between a "production" and "test" classpath, so you can get compile errors in Maven when everything looks great in Eclipse.
My solution was to use the plugin to keep the classpath in sync and compile from the commandline.
there is an ant task to do xml transformations, we used that task to create the classpath in our build file. It was a little trick to get the XSL right but once it worked it was great
Did you evaluate Apache IVY? Currently I am building a Continuous Integration environment at our place and we use IVY to handle our dependencies. There is a eclipse plugin that takes the dependency configuration of eclipse and uses it as eclipse classpath.
Currently this solution looks quite promising.
My team wrote an Eclipse plug-in to add a new type of library to the Java Build Path->Add Library option in the project settings. This custom library type allowed both Eclipse and ANT to reference the same canonical list of dependencies.
Nowadays, I'd probably look at IVY for doing the same thing if I was locked into using ANT, rather than writing my own.
You need Ant2Eclipse.