chen
chen

Reputation: 4490

how to write a portable build.xml?

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

Upvotes: 0

Views: 241

Answers (3)

Bill K
Bill K

Reputation: 62789

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

Upvotes: 1

Mark O'Connor
Mark O'Connor

Reputation: 77971

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.

Upvotes: 0

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.

Upvotes: 1

Related Questions