Database Migration with 2Pack

Level: Intermediate Module: Architecture 14 min read Lesson 20 of 47

Overview

  • What you’ll learn:
    • What 2Pack is and how PackOut and PackIn work for exporting and importing Application Dictionary changes
    • The XML format structure, what can be packaged, and how to handle data versus metadata
    • Migration file naming conventions, 2Pack in plugin development, versioning strategies, and common pitfalls
  • Prerequisites: Lessons 1–19 (especially Lesson 2: iDempiere Architecture Overview and Lesson 18: OSGi Framework)
  • Estimated reading time: 20 minutes

Introduction

One of the recurring challenges in ERP customization is moving changes between environments. When you create a new window, add columns to a table, define a process, or configure menu entries in your development environment, you need a reliable way to replicate those changes in testing, staging, and production environments. Running SQL scripts by hand is error-prone and fragile. Manually recreating Application Dictionary entries is tedious and unreliable.

iDempiere solves this problem with 2Pack (also written as “2pack” or “TwoPack”) — a built-in tool for packaging Application Dictionary changes into portable XML files that can be exported from one environment and imported into another. 2Pack is the standard mechanism for distributing AD customizations, and it is an essential tool in every iDempiere developer’s workflow.

What is 2Pack?

2Pack consists of two complementary processes:

  • PackOut — Exports selected Application Dictionary objects (tables, columns, windows, tabs, fields, menus, processes, roles, and more) into a structured XML file.
  • PackIn — Reads a 2Pack XML file and applies the changes to the target environment, creating or updating AD records as specified.

Think of 2Pack as a version-controlled migration system specifically designed for iDempiere’s Application Dictionary. It captures not just the raw data but the intent — “create this table with these columns,” “add this field to this tab,” “register this process in this menu.” When PackIn applies the changes, it understands the relationships between AD objects and handles them in the correct order.

PackOut vs Manual SQL

You might wonder why you cannot simply export the relevant rows from AD tables using SQL dumps. There are several reasons 2Pack is superior:

  • Dependency ordering — 2Pack exports objects in the correct dependency order. A field export includes references to its column, tab, and window. PackIn creates objects in the right sequence.
  • Environment independence — 2Pack uses UUIDs and logical references rather than database-specific primary key IDs, making packs portable between environments where auto-generated IDs differ.
  • Idempotent application — PackIn can be applied multiple times safely. If an object already exists, it is updated rather than duplicated.
  • Audit trail — PackIn logs what it created or modified, providing a record of changes.

Creating a 2Pack Export (PackOut)

To export AD changes using PackOut, follow these steps in the iDempiere web interface:

Step 1: Navigate to Pack Out

Open the menu and navigate to System Admin > General Rules > Pack Out – Create a package. Alternatively, search for “Pack Out” in the global search bar.

Step 2: Create a New Pack Out Record

Create a new record in the Pack Out window. Fill in:

  • Name — A descriptive name for the pack (e.g., “Custom Invoice Fields v1.0”)
  • Version — The version string (e.g., “1.0.0”)
  • Description — What changes this pack contains
  • File Name — The output file path where the XML will be written (e.g., /tmp/CustomInvoiceFields.zip)

Step 3: Add Export Details

Switch to the Pack Out Detail tab. Here you add individual items to export. For each item, specify:

  • Type — The type of AD object (Table, Window, Process, Menu, Form, Role, SQL Statement, Code or Other File, Data, etc.)
  • Entity selection — The specific object to export (e.g., which window, which table)

Common export types include:

Type What it Exports
Table Table definition, all its columns, and related database DDL
Window Window definition, all its tabs, and all fields within each tab
Process Process definition and its parameters
Menu Menu entry and its placement in the menu tree
Form Form definition
Role Role definition and access rights
SQL Statement Raw SQL to execute during PackIn (for data migrations)
Data Actual data records from a specified table
Code or Other File Non-AD files (SQL scripts, reports, etc.) to include in the pack

Step 4: Run the Export

Click the Export Package button (or run the Pack Out process from the toolbar). 2Pack will generate a ZIP file containing the XML pack file and any additional files referenced in the export details.

The 2Pack XML Format

Understanding the XML structure helps with troubleshooting and manual editing when needed. A 2Pack XML file follows this general structure:

<?xml version="1.0" encoding="UTF-8"?>
<adempiereAD>
  <header>
    <name>Custom Invoice Fields</name>
    <version>1.0.0</version>
    <description>Adds custom fields to the Invoice window</description>
    <createddate>2025-01-15 10:30:00</createddate>
    <updateddate>2025-01-15 10:30:00</updateddate>
  </header>

  <!-- Table definition with columns -->
  <table AD_Table_UU="a1b2c3d4-e5f6-7890-abcd-ef1234567890"
         TableName="C_Invoice"
         action="update">
    <column AD_Column_UU="..."
            ColumnName="CustomField1"
            AD_Reference_ID="10"
            FieldLength="100"
            DefaultValue=""
            IsMandatory="N"
            IsUpdateable="Y"
            action="insert"/>
  </table>

  <!-- Window with tabs and fields -->
  <window AD_Window_UU="..."
          Name="Invoice (Vendor)"
          action="update">
    <tab AD_Tab_UU="..."
         Name="Invoice"
         action="update">
      <field AD_Field_UU="..."
             Name="Custom Field 1"
             AD_Column_ID="..."
             SeqNo="999"
             IsDisplayed="Y"
             action="insert"/>
    </tab>
  </window>

  <!-- Process definition -->
  <process AD_Process_UU="..."
           Value="CustomProcess"
           Name="My Custom Process"
           Classname="com.example.myplugin.process.MyProcess"
           action="insert"/>

  <!-- Menu entry -->
  <menu AD_Menu_UU="..."
        Name="My Custom Process"
        action="insert"/>
</adempiereAD>

Key XML Concepts

  • action attribute — Each element has an action attribute that can be insert (create new), update (modify existing), or merge (create if not exists, update if exists). The merge action is the safest for idempotent application.
  • UUID references — Objects are identified by their UUID (AD_Table_UU, AD_Column_UU, etc.) rather than integer IDs. This ensures portability between environments.
  • Hierarchical structure — Child objects (columns within tables, fields within tabs, tabs within windows) are nested inside their parent elements, reflecting the Application Dictionary hierarchy.

What Can Be Packaged

2Pack can package the following categories of AD objects:

Metadata (Application Dictionary)

  • Tables and Columns — Table definitions, column definitions, and the DDL to create or alter the physical database tables
  • Windows, Tabs, and Fields — The complete UI definition hierarchy
  • Processes and Parameters — Process definitions and their input parameters
  • Forms — Custom form definitions
  • Menus — Menu tree entries and their hierarchy
  • References and Validation Rules — Dropdown lists, table references, and validation logic
  • Messages — System messages and translations
  • Roles and Access — Role definitions and access permissions
  • Report Views and Print Formats — Report configurations
  • Workflows — Workflow definitions and nodes

Data

  • Reference data — List values, document types, tax categories, and other configuration data
  • Master data — Business partner records, product records, chart of accounts entries (use with caution)
  • SQL statements — Raw SQL for data manipulation that does not fit AD object categories

Files

  • Report templates — JasperReports .jrxml files
  • SQL migration scripts — Additional DDL or DML scripts
  • Other resources — Any files that need to be distributed with the pack

Applying a Pack (PackIn)

To import a 2Pack into a target environment:

Using the Web Interface

  1. Navigate to System Admin > General Rules > Pack In – Import a package
  2. Upload or specify the path to the 2Pack ZIP file
  3. Click the Import Package button
  4. PackIn processes the XML file, creates or updates AD objects, executes any SQL statements, and copies any included files
  5. Review the log output for any errors or warnings

Using the Command Line

For automated deployments, you can apply 2Pack files from the command line using iDempiere’s sign-database-build script or by directly invoking the PackIn process:

# Apply a 2Pack during server startup
# Place the ZIP file in the migration directory
cp MyPackage.zip $IDEMPIERE_HOME/migration/local/

iDempiere automatically scans the migration/ directory on startup and applies any pending 2Pack files.

Handling Data vs Metadata

A critical distinction in 2Pack is the difference between metadata (Application Dictionary definitions) and data (business records). The rules differ:

  • Metadata — Generally safe to export and import. AD definitions are intended to be consistent across environments. Use the merge action to handle both new installations and updates.
  • Data — Requires careful consideration. Exporting data records can overwrite environment-specific data in the target. Only export data that is truly configuration data (reference lists, document types) rather than transactional data (orders, invoices).

A common mistake is exporting data records that include auto-generated IDs that differ between environments. Always use UUIDs or natural keys (like the Value column) when referencing data across environments.

Migration File Naming Conventions

iDempiere follows a specific naming convention for migration files that ensures they are applied in the correct order:

migration/
├── i11-release/
│   └── postgresql/
│       ├── 202501011200_IDEMPIERE-6001.sql
│       └── 202501021400_IDEMPIERE-6002.sql
├── local/
│   ├── 202501150930_CustomInvoiceFields.zip
│   └── 202502011000_UpdateTaxRates.zip
└── processes_post_migration/
    └── ...

Key conventions:

  • Timestamp prefix — Files are named with a YYYYMMDDHHMI timestamp prefix that determines the order of application. Files are processed in alphabetical (and therefore chronological) order.
  • Descriptive suffix — After the timestamp, include a meaningful description and optionally a ticket/issue number.
  • i11-release/ — Contains official iDempiere release migrations, organized by database type.
  • local/ — Contains custom 2Pack files and SQL scripts specific to your deployment. This is where your plugin migrations go.
  • processes_post_migration/ — Contains processes that should run after all SQL migrations are applied.

2Pack in Plugin Development

For plugin developers, 2Pack is the standard way to distribute Application Dictionary changes that your plugin requires. A well-structured plugin includes its 2Pack files in the plugin bundle, and they are automatically applied when the plugin is installed.

Including 2Pack in a Plugin Bundle

Place your 2Pack ZIP files in a specific directory within your plugin project:

com.example.myplugin/
├── META-INF/
│   └── MANIFEST.MF
├── src/
│   └── ...
├── OSGI-INF/
│   └── component.xml
└── migration/
    └── local/
        ├── 202501150930_InitialSetup.zip
        └── 202502011000_Version2Update.zip

In your MANIFEST.MF, include the migration directory in the bundle’s classpath or use the migration handler to apply packs when the bundle starts:

Bundle-ClassPath: .,migration/

Automating PackIn During Plugin Activation

Your plugin’s Activator (or a DS component) can programmatically trigger PackIn when the bundle starts:

package com.example.myplugin;

import java.io.File;
import org.compiere.utils.Util;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

    @Override
    public void start(BundleContext context) throws Exception {
        // Find the migration directory within the bundle
        String migrationPath = context.getBundle()
            .getEntry("migration/local/").getPath();

        // PackIn logic would process files in this directory
        // The actual implementation varies — see iDempiere's
        // AbstractActivator for a base class that handles this
    }

    @Override
    public void stop(BundleContext context) throws Exception {
        // Cleanup if needed
    }
}

Many plugin developers extend org.adempiere.plugin.utils.AdempiereActivator, which provides built-in support for applying 2Pack files from the bundle’s migration directory.

Common Pitfalls

Working with 2Pack involves several common traps that developers should be aware of:

Dependency Order

Objects must be exported in the correct dependency order. For example, if you add a column to a table and then add a field for that column to a window, the column must be created before the field. 2Pack generally handles this within a single pack file, but when splitting changes across multiple pack files, you must ensure the timestamp-based ordering reflects the dependency chain.

Missing References

If your pack references an object that does not exist in the target environment (e.g., a column referencing a table that hasn’t been created yet, or a menu entry pointing to a window from another pack), the import will fail. Always verify that all prerequisites are included in the pack or applied first.

Client and Organization Context

When exporting data records, be aware that the Client (AD_Client_ID) and Organization (AD_Org_ID) context may differ between environments. Use the System client (AD_Client_ID=0) for dictionary-level objects and ensure data exports use the correct client context.

Overwriting Customizations

Applying a 2Pack to an environment that has been manually customized can overwrite those customizations. Always review the pack contents before applying to production, and maintain a clear record of manual changes in each environment.

Large Packs

Very large 2Pack files (with hundreds of objects) can be slow to process and difficult to debug when errors occur. Consider breaking large changes into smaller, focused packs that can be applied incrementally.

Versioning and Upgrade Paths

As your plugin evolves, you will need a versioning strategy for your 2Pack migrations:

  • Incremental migrations — Each version of your plugin adds new 2Pack files rather than modifying existing ones. Version 1.0 includes 202501150930_v1.0_InitialSetup.zip; version 1.1 adds 202503011000_v1.1_NewFields.zip.
  • Cumulative packs — For fresh installations, you may also provide a single cumulative pack that includes all changes up to the current version. This is faster than applying dozens of incremental packs.
  • Version tracking — iDempiere’s AD_Package_Imp table records which packs have been applied. Your plugin can check this table to determine which migrations still need to be applied.
-- Check which packs have been applied
SELECT Name, Version, PK_Status, Created
FROM AD_Package_Imp
WHERE Name LIKE '%MyPlugin%'
ORDER BY Created;

Automating Migrations

For teams practicing continuous integration and deployment, 2Pack migrations can be automated:

  1. Version control — Store 2Pack files in your plugin’s source repository alongside the Java code.
  2. Build pipeline — Include 2Pack files in the plugin’s build output (JAR/bundle).
  3. Auto-apply on startup — Use the AdempiereActivator or a custom DS component to apply pending packs when the plugin starts.
  4. Rollback strategy — While 2Pack does not natively support rollback, you can create reverse packs that undo changes, or use database snapshots before applying major updates.

Key Takeaways

  • 2Pack is iDempiere’s built-in tool for packaging Application Dictionary changes as portable XML files (PackOut) and applying them to other environments (PackIn).
  • Use 2Pack instead of manual SQL scripts — it handles dependency ordering, uses UUIDs for portability, and supports idempotent application.
  • Distinguish between metadata (AD definitions, safe to migrate) and data (business records, migrate with caution).
  • Follow the timestamp-based naming convention for migration files to ensure correct ordering.
  • Include 2Pack files in your plugin bundles and use the AdempiereActivator base class to auto-apply them during installation.
  • Watch for common pitfalls: dependency ordering across multiple packs, missing references, and overwriting manual customizations.

What’s Next

With a solid understanding of iDempiere’s architecture, extension points, and migration tools, you are ready to start building plugins. In the next lesson, you will create your first iDempiere plugin from scratch — setting up the project, configuring the manifest, writing an activator, and deploying it to a running iDempiere instance.

繁體中文

概述

  • 學習內容:什麼是 2Pack 以及 PackOut 和 PackIn 如何用於匯出和匯入應用程式字典變更;XML 格式結構、可打包的內容,以及如何處理資料與中繼資料;遷移檔案命名慣例、Plugin 開發中的 2Pack、版本控制策略和常見陷阱。
  • 先修條件:第 1-19 課(尤其是第 2 課和第 18 課)
  • 預估閱讀時間:20 分鐘

簡介

ERP 自訂中反覆出現的挑戰之一是在環境之間遷移變更。當您在開發環境中建立新視窗、新增資料表欄位、定義流程或配置選單項目時,需要一種可靠的方式來在測試、預備和生產環境中複製這些變更。

iDempiere 使用 2Pack(也寫作「2pack」或「TwoPack」)解決這個問題——一個內建工具,用於將應用程式字典變更打包為可攜的 XML 檔案,可從一個環境匯出並匯入另一個環境。

什麼是 2Pack?

2Pack 由兩個互補的流程組成:

  • PackOut——將選定的應用程式字典物件匯出為結構化的 XML 檔案。
  • PackIn——讀取 2Pack XML 檔案並將變更套用至目標環境。

2Pack 優於手動 SQL 的原因:

  • 相依性排序——2Pack 以正確的相依性順序匯出物件。
  • 環境獨立性——使用 UUID 和邏輯參照而非資料庫特定的主鍵 ID。
  • 冪等套用——PackIn 可以安全地多次套用。
  • 稽核追蹤——PackIn 記錄其建立或修改的內容。

建立 2Pack 匯出(PackOut)

  1. 導覽至系統管理 > 一般規則 > Pack Out
  2. 建立新的 Pack Out 記錄,填入名稱、版本、描述和輸出檔案路徑。
  3. 切換至 Pack Out Detail 頁籤,新增個別匯出項目(Table、Window、Process、Menu 等)。
  4. 點擊匯出套件按鈕。

2Pack XML 格式

XML 中的關鍵概念:

  • action 屬性——insert(建立新的)、update(修改現有的)或 merge(不存在則建立,存在則更新)。merge 對於冪等套用最安全。
  • UUID 參照——物件以其 UUID 識別,確保環境之間的可攜性。
  • 階層結構——子物件巢狀在其父元素內。

可打包的內容

中繼資料:資料表和欄位、視窗/頁籤/欄位、流程和參數、表單、選單、參照和驗證規則、訊息、角色和存取、報表、工作流程。

資料:參考資料、主資料(謹慎使用)、SQL 語句。

檔案:報表範本、SQL 遷移腳本、其他資源。

套用 Pack(PackIn)

透過 Web 介面:導覽至系統管理 > 一般規則 > Pack In,上傳或指定路徑,點擊匯入。

透過命令列:將 ZIP 檔案放入 migration/local/ 目錄,iDempiere 在啟動時自動掃描並套用。

處理資料與中繼資料

  • 中繼資料——通常可安全匯出和匯入。使用 merge 動作處理新安裝和更新。
  • 資料——需要謹慎考慮。僅匯出真正的配置資料,而非交易資料。

遷移檔案命名慣例

migration/
├── i11-release/          -- 官方 iDempiere 版本遷移
├── local/                -- 自訂 2Pack 檔案和 SQL 腳本
└── processes_post_migration/  -- 遷移後執行的流程

檔案使用 YYYYMMDDHHMI 時間戳前綴命名,確保按正確順序套用。

Plugin 開發中的 2Pack

將 2Pack 檔案放在 Plugin 專案的 migration/local/ 目錄中,並在 MANIFEST.MF 中包含。許多 Plugin 開發者繼承 org.adempiere.plugin.utils.AdempiereActivator,它提供內建支援,可從 Bundle 的遷移目錄自動套用 2Pack 檔案。

常見陷阱

  • 相依性順序:跨多個 Pack 檔案時確保時間戳排序反映相依鏈。
  • 缺少參照:確保所有先決條件都包含在 Pack 中或先行套用。
  • 用戶端和組織上下文:字典層級物件使用系統用戶端(AD_Client_ID=0)。
  • 覆蓋自訂:在套用至生產環境前檢查 Pack 內容。
  • 大型 Pack:考慮將大型變更拆分為較小的增量 Pack。

版本控制和升級路徑

  • 增量遷移——每個版本新增新的 2Pack 檔案而非修改現有的。
  • 累積 Pack——為全新安裝提供包含所有變更的單一 Pack。
  • 版本追蹤——AD_Package_Imp 資料表記錄已套用的 Pack。

重點摘要

  • 2Pack 是 iDempiere 的內建工具,用於將應用程式字典變更打包為可攜的 XML 檔案(PackOut)並套用至其他環境(PackIn)。
  • 使用 2Pack 而非手動 SQL 腳本——它處理相依性排序、使用 UUID 確保可攜性,並支援冪等套用。
  • 區分中繼資料(AD 定義,可安全遷移)和資料(業務記錄,謹慎遷移)。
  • 遵循基於時間戳的命名慣例以確保正確排序。
  • 將 2Pack 檔案包含在 Plugin Bundle 中,使用 AdempiereActivator 基礎類別在安裝期間自動套用。
  • 注意常見陷阱:跨多個 Pack 的相依性排序、缺少參照和覆蓋手動自訂。

下一步

有了對 iDempiere 架構、擴展點和遷移工具的紮實了解,您已準備好開始建立 Plugin。在下一課中,您將從零開始建立您的第一個 iDempiere Plugin——設定專案、配置 Manifest、撰寫 Activator,並將其部署至執行中的 iDempiere 實例。

日本語

概要

  • 学習内容:2Packとは何か、PackOutとPackInがアプリケーション辞書変更のエクスポートとインポートにどのように機能するか。XML形式の構造、パッケージ化可能なもの、データとメタデータの扱い方。マイグレーションファイルの命名規則、プラグイン開発における2Pack、バージョニング戦略、一般的な落とし穴。
  • 前提条件:レッスン1〜19(特にレッスン2とレッスン18)
  • 推定読了時間:20分

はじめに

ERPカスタマイズにおける繰り返し発生する課題の1つは、環境間での変更の移行です。開発環境で新しいウィンドウの作成、テーブルへのカラム追加、プロセスの定義、メニューエントリの設定を行った場合、テスト、ステージング、本番環境でそれらの変更を確実に再現する方法が必要です。

iDempiereは2Pack(「2pack」や「TwoPack」とも表記)でこの問題を解決します——アプリケーション辞書の変更をポータブルなXMLファイルにパッケージ化し、ある環境からエクスポートして別の環境にインポートできる組み込みツールです。

2Packとは?

2Packは2つの補完的なプロセスで構成されます:

  • PackOut——選択されたアプリケーション辞書オブジェクトを構造化されたXMLファイルにエクスポート。
  • PackIn——2Pack XMLファイルを読み取り、ターゲット環境に変更を適用。

2Packが手動SQLより優れている理由:

  • 依存関係の順序付け——2Packは正しい依存関係順序でオブジェクトをエクスポート。
  • 環境非依存——データベース固有の主キーIDではなくUUIDと論理参照を使用。
  • 冪等な適用——PackInは複数回安全に適用可能。
  • 監査証跡——PackInは作成・変更した内容をログ記録。

2Packエクスポートの作成(PackOut)

  1. システム管理 > 一般ルール > Pack Outに移動。
  2. 新しいPack Outレコードを作成(名前、バージョン、説明、出力ファイルパスを入力)。
  3. Pack Out Detailタブで個々のエクスポート項目を追加(Table、Window、Process、Menuなど)。
  4. パッケージエクスポートボタンをクリック。

2Pack XML形式

XMLの主要概念:

  • action属性——insert(新規作成)、update(既存を修正)、merge(なければ作成、あれば更新)。mergeが冪等な適用に最も安全。
  • UUID参照——オブジェクトはUUIDで識別され、環境間のポータビリティを確保。
  • 階層構造——子オブジェクトは親要素内にネスト。

パッケージ化可能なもの

メタデータ:テーブルとカラム、ウィンドウ/タブ/フィールド、プロセスとパラメータ、フォーム、メニュー、リファレンスとバリデーションルール、メッセージ、ロールとアクセス、レポート、ワークフロー。

データ:参照データ、マスタデータ(注意して使用)、SQLステートメント。

ファイル:レポートテンプレート、SQLマイグレーションスクリプト、その他のリソース。

Packの適用(PackIn)

Webインターフェース経由:システム管理 > 一般ルール > Pack Inに移動、アップロードまたはパスを指定、インポートをクリック。

コマンドライン経由:ZIPファイルをmigration/local/ディレクトリに配置。iDempiereは起動時に自動スキャンして適用。

データ vs メタデータの扱い

  • メタデータ——一般的にエクスポート・インポートが安全。mergeアクションで新規インストールと更新の両方を処理。
  • データ——慎重な検討が必要。真の設定データのみエクスポートし、取引データはエクスポートしない。

マイグレーションファイルの命名規則

migration/
├── i11-release/          -- 公式iDempiereリリースマイグレーション
├── local/                -- カスタム2PackファイルとSQLスクリプト
└── processes_post_migration/  -- マイグレーション後に実行するプロセス

ファイルはYYYYMMDDHHMIタイムスタンププレフィックスで命名し、正しい順序での適用を保証。

プラグイン開発における2Pack

2Packファイルをプラグインプロジェクトのmigration/local/ディレクトリに配置し、MANIFEST.MFに含めます。多くのプラグイン開発者はorg.adempiere.plugin.utils.AdempiereActivatorを継承し、バンドルのマイグレーションディレクトリから2Packファイルを自動適用する組み込みサポートを活用します。

一般的な落とし穴

  • 依存関係の順序:複数のPackファイルにまたがる場合、タイムスタンプの順序が依存チェーンを反映するよう確認。
  • 不足している参照:すべての前提条件がPackに含まれているか、先に適用されていることを確認。
  • クライアントと組織のコンテキスト:辞書レベルのオブジェクトにはシステムクライアント(AD_Client_ID=0)を使用。
  • カスタマイズの上書き:本番環境への適用前にPack内容を確認。
  • 大きなPack:大きな変更をより小さな増分Packに分割することを検討。

バージョニングとアップグレードパス

  • 増分マイグレーション——各バージョンで既存のものを変更するのではなく新しい2Packファイルを追加。
  • 累積Pack——新規インストール用に現在のバージョンまでのすべての変更を含む単一Packを提供。
  • バージョン追跡——AD_Package_Impテーブルが適用済みPackを記録。

重要ポイント

  • 2PackはiDempiereの組み込みツールで、アプリケーション辞書変更をポータブルなXMLファイルとしてパッケージ化(PackOut)し、他の環境に適用(PackIn)する。
  • 手動SQLスクリプトの代わりに2Packを使用——依存関係の順序付け、UUIDによるポータビリティ、冪等な適用をサポート。
  • メタデータ(AD定義、安全にマイグレーション可能)とデータ(ビジネスレコード、慎重にマイグレーション)を区別。
  • タイムスタンプベースの命名規則に従い正しい順序を確保。
  • プラグインバンドルに2Packファイルを含め、AdempiereActivator基底クラスでインストール時に自動適用。
  • 一般的な落とし穴に注意:複数Pack間の依存関係順序、不足参照、手動カスタマイズの上書き。

次のステップ

iDempiereのアーキテクチャ、拡張ポイント、マイグレーションツールをしっかり理解したので、プラグインの構築を開始する準備ができました。次のレッスンでは、最初のiDempiereプラグインをゼロから作成します——プロジェクトの設定、マニフェストの設定、アクティベータの作成、実行中のiDempiereインスタンスへのデプロイです。

You Missed