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

前端 未结 3 544
青春惊慌失措
青春惊慌失措 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:24

    To ensure your build is more cross platform I'd suggest using dependency management. The ivy plug-in can automatically install the version of your build's plugin at build-time.

    This approach means the last jar you'll ever need to install into your ANT lib is ivy-2.2.0.jar :-)

    First declare your project's dependencies in the file ivy.xml

    
        
        
            
        
        
            
        
    
    

    Within your build.xml run ivy and use it to populate a custom classpath based on the ivy configuration:

    
        
        
    
    

    Finally, elsewhere in your build declare your ANT tasks using the class path now automatically populated by ivy.

    
        
        ..
        ..
    
    

    This approach works for all ANT plug-ins, most of which are available in the central Maven repository. The second benefit is that it's easy to upgrade the plug-in versions across all builds.

提交回复
热议问题