MKS Integrity Java api在createsandbox上抛出异常

时间:2017-07-11 12:15:06

标签: java mks mks-integrity

我尝试实现Java应用程序以同步沙箱。

Command cmd = new Command( Command.SI, "createsandbox" );
cmd.addOption( new Option( "recurse" ) );
cmd.addOption( new Option( "nopopulate" ) );
cmd.addOption( new Option( "project", ptcProject ) );
cmd.addOption( new Option( "cwd", sandboxDir ) );
api.runCommand( cmd );

这部分源代码我得到了这个例外。

Sandboxes cannot be created or imported directly on the Integrity Server.

作为我用于项目的输入

Project: #p=e:/MKSProjects/<unknown>/<unknown>.pj#<subproject>/project.pj
cwd: C:\\Temp\\<notexistingfolder>

这里有什么问题?我的MKSAPI.jar版本是4.15

1 个答案:

答案 0 :(得分:0)

正如@vasilenicusor所说,使用LocalIntegrationPoint在本地计算机上创建沙箱。

此代码按照您期望的方式运行...

IntegrationPointFactory ipfact = IntegrationPointFactory.getInstance();

IntegrationPoint ip = ipfact.createLocalIntegrationPoint(APIVersion.API_4_16);

Session session = ip.createNamedSession("test", APIVersion.API_4_16, user, passwd);

CmdRunner cr = session.createCmdRunner();

Command cmd = new Command( Command.SI, "createsandbox" );
cmd.addOption( new Option( "recurse" ) );
cmd.addOption( new Option( "nopopulate" ) );
cmd.addOption( new Option( "project", ptcProject ) );
cmd.addOption( new Option( "cwd", sandboxDir ) );

cr.execute(cmd);

cr.release();

session.release();

ip.release();