0

我有多個自定義生成的配置在我的項目,如下圖所示: Screenshot of build configurations如何在工作區啓動時從「調試」更改默認/活動構建配置?

在工作區設置在默認情況下它「調試」配置打開。我必須將此更改爲'Rev8 Release'(我的自定義配置之一)。

的一種方式,我可以通過手動編輯.cprojects文件(自動生成的項目設置文件)實現這一點,前「調試」粘貼「Rev8發佈」配置。但我需要一個適當的方法(通過更改項目設置)來做到這一點,而無需手動編輯'.cprojects'

回答

0

我建議檢出ManagedBuildManager。它可以用來檢索/修改項目的構建信息。

IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(iproject); //iproject is the currently selected project in Project Explorer 
IConfiguration [] buildConfigs = info.getManagedProject().getConfigurations(); //Get the available build configurations of the project 
info.setDefaultConfiguration(buildConfigs[i]); //Set default build configuration 
try { 
ManagedBuildManager.saveBuildInfo(iproject, true); //Apply changes 
} catch (Exception e) { 
}