配置 p2 產品

依預設,PDE/Build 將為您自動產生啟動層次和其他配置資訊。它的作法是在p2.inf 檔案中產生內容。 如果產品提供它自己的 p2.inf 檔案,則 PDE/Build 將附加至該檔案的副本。可在 p2.inf 中定義部分內容來暫停此行為:

org.eclipse.pde.build.append設為 false,不要附加任何預設值至 p2.inf 檔案。
org.eclipse.pde.build.append.startlevels設為 false,不要附加啟動層次資訊至 p2.inf 檔案。
org.eclipse.pde.build.append.launchers設為 false,不要在 p2.inf 檔案中併入啟動程式。

啟動層次

可在產品編輯器的配置標籤中,手動設定啟動層次資訊。如果有任何啟動層次資訊設定在 .product 檔案中,則 PDE/Build 將不會產生任何預設值。 這表示如果您決定設定任何自訂啟動層次,則您必須設定需要它們的所有軟體組的啟動層次。PDE/Build 為 p2 產品所產生的預設啟動層次為:

軟體組啟動層次 自動啟動
org.eclipse.equinox.simpleconfigurator1true
org.eclipse.equinox.common2true
org.eclipse.update.configurator4(預設值)true
org.eclipse.core.runtime4(預設值)true
org.eclipse.equinox.ds2true

設定 org.eclipse.update.configurator 的啟動層次時,除了這些內容之外,PDE/Build 也會自動設定org.eclipse.update.reconcile=false。

Config.ini 內容

PDE/Build 所使用的 p2 產品發佈者會根據 .product 檔案中的設定,自動設定一些 config.ini 內容:

內容根據
eclipse.product在產品編輯器的概觀標籤上設定的產品。
eclipse.application在產品編輯器的概觀標籤上設定的應用程式。
osgi.splashPath在產品編輯器的「啟動畫面」標籤上設定的外掛程式。

也可以將任意 config.ini 內容新增至 .product 檔案中,不過,編輯器沒有此標籤,因此必須以 xml 格式編輯 .product 檔案,來手動完成此動作。

以此方式設定內容的範例如下:

	...
	<configurations>
	   <-- The product editor will generate start level information like this:
	   <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
	   -->                                     
	   <property name="osgi.bundles.defaultStartLevel" value="4" />
	   <property name="osgi.requiredJavaVersion" value="1.5.0"/>
	</configurations>
	...

啟動程式

PDE/Build 將自動建立啟動程式品牌(這是它從差異套件的 org.eclipse.equinox.executable 特性中取得的)。這些啟動程式將連同所產生的 meta 資料自動併入產品中,此 meta 資料將在產品 ini 檔案中設定適當的 -startup 和 --launcher.library 引數。

因為特性 meta 資料結構中與根檔案相關的變更,所以 org.eclipse.equinox.executable 特性不應直接併入產品中。