Integrate ant with dbdeploy not in the classpath

5 thoughts on “Integrate ant with dbdeploy not in the classpath”

  1. You might also try the classpathref attribute for taskdef so that you can define you classpath in a “path” element and use the same classpath path element for other things. This way you can add stuff to the single path element and all of the other things that use that for the classpath get updated.

    Nice post.

  2. I actually do. The real code is:

    <taskdef name=”dbdeploy”
    classpathref=”dbdeploy.path”
    classname=”net.sf.dbdeploy.AntTarget”/>

    Where dbdeploy.path is set by:

    <ivy:cachepath pathid=”dbdeploy.path”
    conf=”dbdeploy” />

    Which in turn comes from the dbdeploy conf in ivy.xml config. But I didn’t want to dive into that in the post.

  3. It’s driving me CRAZY! :

    It works fine for something simple like :

    This set up will put the mysql-connector.jar into the lib dir, and everything is good, but if the dependency is more complex i.e. Spring than it will additionally retrieve all of it’s dependencies and place them into the lib as well.

    This seems abvious because this is the purpose of ivy in the first place, but what happens if one of the jars happens to have a conflict with something else once deployed, i.e. with Tomcat?

    For example :

    This will retieve jars that will pose conflics with Tomcat once deployed, so I have to end up deleting like 20 jars for everything to settle down.

    If all I want is spring.jar or spring-webmvc.jar how can I do this?

    Thanks.

  4. Oh! Well it chopped out my code. Sorry about that.

    <dependency org="org.springframework" name="org.springframework.web" rev="2.5.6.SEC01" />
    
    <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]"/>
    

    This will retrieve spring-web.jar in addition to like 20 others, but some pose conflicts, so how do I retrieve just the spring-web.jar?

    Hopefully the code is visible this time.

    1. Sorry for the slow response, didn’t see your comment in here. I don’t think there is a way to just get the single jar, at least not that I know of. The whole point is that Ivy gets all the dependancies for you.

      My guess here is that, because tomcat is not under ivy, that you have jar conflicts. Ivy is great at resolving conflicts between all the jars you have listed in it but it cant deal with jars it doesn’t know about.

      One hack of a way would be to download the single jar you want and have ivy get it from your hard drive or scm by editing the ivysettings.xml to add the path to the jar in the list of places ivy will look for the jar. That way it won’t know about the other dependancies. I’ve used this pattern for things that are not in a maven repo but it might work here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s