2016-03-03 55 views
0

我想映射从gradle任务驱动器。我知道如何从蚂蚁做到这一点,但有人可以让我知道如何将该蚂蚁任务转换为gradle并在windows server上映射驱动器 。以下是我的ant任务映射驱动器,并删除映射驱动器Gradle - 如何映射驱动器?

<target name="createmap"> 
    <property name="user231" value="${deployip}\${deployuser}"/> 
    <exec executable="cmd.exe"> 
     <arg line="/c if not exist ${mapdir} net use ${mapdir} \\${deployip}\Sites ${deploypw} /USER:${user231}"/> 
    </exec> 
</target> 
<target name="deletemap"> 
    <exec executable="cmd.exe"> 
     <arg line="/c if exist ${mapdir} net use ${mapdir} /delete"/> 
    </exec> 
</target> 
+0

改进格式 – rcs

回答

0

我用下面的代码,它工作正常

task drivemap(type:Exec) { 

    //on windows: 
    commandLine 'cmd', '/c', 'net use z: /delete' 
    commandLine 'cmd', '/c', 'NET USE Z: \\x.x.x.x\ZDrive\Clinprod %megpass% /USER:TSH\%meguser%' 
    commandLine 'cmd', '/c', 'Z:' 
    commandLine 'cmd', '/c', 'xcopy /Y Z:\Episodes\Development\Meg%version%\drop\Build%buildNumber% D:\MegDS\release /e/s' 

    //store the output instead of printing to the console: 
    standardOutput = new ByteArrayOutputStream() 

    //extension method drivemap.output() can be used to obtain the output: 
    ext.output = { 
    return standardOutput.toString() 
    } 

}