Search code examples
eclipsepackagingpublishingear

EAR packaging and publishing in Eclipse using Ant builder to build the dependent modules


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.


Solution

  • 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.