The best way to delegate an Eclipse generation job is through the Ant constructor. Take a look here on how to set up a builder.
In your build.xml file, create 2 goals: generate-code and cleanup-generated-code .
Then connect them this way in the builder Targets tab:

This will allow your project to respond well to events.
The next step is to get Eclipse to automatically generate your generated sources.
To do this, create a directory named generated-src in the root of your project. This directory must be empty and you must place it under the control of your version control system. Because there will be some generated code, put the .xxxignore file in this directory.
Once the generated-src directory is in place, make it the project’s source directory (Source tab in the Java build path)

Last but not least, you want to run the Eclipse java compiler once you have created your sources. To do this, you need to change the Refresh tab for you Ant builder.
Here is the setup that does this:

When you click the Specify Resources button, make sure that the entire project directory is selected, for example:

Thus, when something in your project changes, it launches the Ant constructor, which may or may not restore the sources, which will lead to recompilation of Java.
Last screenshot. Make sure that both build.xml and the base directory refer to your $ {workspace_loc} in the Builder Main tab, for example here (basically use the Browse Workspace button):

Once this is done, connect generate-code and cleanup-generated-code to your usual goals in build.xml , which you invoke to build the command line. In this way, Eclipse and your command line assembly follow exactly the same steps to generate the code. In addition, your Eclipse build will be completely sensitive to the real sources of your project.