I have a project which as part of the build process creates an XMLBeans jar file (stbSchemas.jar) which I want to include and reference in this project.
Is this the best way to go about this (Single project) or should I have a child project which is built from the parent project?
I am building this using Maven2 inside Eclipse. Is there a better way to do this so that I can maintain the integrity of the projects and stability of the builds.
Hmm. If I understand correctly, you’re saying that the you need to reference the stbSchemas.jar in your project in order to build some code that DOESN’T go into the stbSchemas.jar file. If that’s a correct assumption, then I think you should probably do a little bit of refactoring so that you have something like this:
1) a Maven parent pom file at the top level of the project. That parent pom has a modules section that would reference the 2 modules from step 2. E.G:
2) Split the code into clean modules. stbSchemas would be the first, your other code would be a 2nd module. Each of those modules gets its own pom.xml file that would reference the parent pom file like this:
The second module’s pom.xml file would also need a dependency section for stbSchemas.jar, like this:
Then, when you build your second module, it’ll pick up stbSchemas.jar.
3) Once you’ve got that (or something similar) setup in Maven, you can use the maven eclipse plugin (mvn eclipse:eclipse) to generate a correct eclipse classpath for the whole project. You can then refresh the project in Eclipse, and that will put stbSchemas.jar on the classpath for you.