How can I specify the path of a JAR in an ant buildfile?

前端 未结 3 559
青春惊慌失措
青春惊慌失措 2020-12-19 04:04

I am executing lot of scp and sshexec and other remote commands from an ant build script. These commands don\'t work if jsch.jar isn\'

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 04:21

    One possible work around would be to use the -lib command line option to tell ant where to look for additional jars. Perhaps you could create a wrapper script that calls ant with this option set.

    Another way would be to move the ant-jsch.jar file (this is the jar that comes with ant that defines the tasks, not the jsch.jar file you need to download separately) out of your ant lib directory, and create a taskdef for your ssh task separate to the built in one, then set the classpath for this task to the jsch.jar and the ant-jsch.jar:

    
      
        
        
      
    
    

    I'm not sure this will help you though, since it also involves making changes to the lib directory.

    As far as I'm aware, it's not currently possible to specify the extra jars required for the built in tasks in the build file itself in general. There are some special cases, like junit for instance.

提交回复
热议问题