收录日期:2020/12/05 03:42:13 时间:2010-09-07 20:22:40 标签:java,ant,osgi

I am using an OSGi framework to do my development, and my develop machine's jar lib path is different from my production machine's.

How can a write my build.xml so that it can make my development easy yet I can ship the software to the production without too much headache? (note: the production people do not know ant and etc very much)

Thanks

Create an ant property which contains the jar lib path, and let it default to the value in production. Refer to it in your build.xml in appropriate locations.

Developers can then override the property as needed in their personal ant launch configuration.

Look into Maven--seriously. It's overall design seems to be as though they were trying to answer your question.

Also it's probably smart enough to suck in your existing build and spit out a maven build that's better.

Not actually a huge maven user myself so sorry if I'm wrong, but this is what it seems like from what I have used...

Use ivy to download your project's jar dependencies and manage your project's classpath.

For example:

<target name="init" description="Initialize the project">
    <ivy:resolve/>
    <ivy:cachepath pathid="compile.path" conf="compile"/>
    <ivy:cachepath pathid="runtime.path" conf="runtime"/>
    <ivy:cachepath pathid="test.path" conf="test"/>
</target>

This coupled with a Maven repository manager (to hold dependencies not available from the internet) would make your build portable across your organisation.