MKS Integrity Java api在createsandbox上抛出异常



我尝试实现一个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

正如@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();

最新更新