公式には Library Wrapper Module を使って、Module Suite に組み込む事を推奨していますが、単体 Module だけで利用することも可能です
今回は例として、「SamplePlugin」Module プロジェクトで Commons Logging を利用するものとします
まずは作成した Module の直下に「release/modules/ext」とディレクトリを作成し、利用したい Jar を置きます
設定後、 Netbeans の Files ウィンドウで確認すると以下のようになります

Projects ウィンドウを開き、 Project Metadata をダブルクリックし、 project.xml ファイルを開きます
ファイルのdata 内に以下を追加します
<class-path-extension>
<runtime-relative-path>ext/commons-logging-1.1.1.jar</runtime-relative-path>
<binary-origin>release/ext/commons-logging-1.1.1.jar</binary-origin>
</class-path-extension>
<runtime-relative-path>ext/commons-logging-1.1.1.jar</runtime-relative-path>
<binary-origin>release/ext/commons-logging-1.1.1.jar</binary-origin>
</class-path-extension>
エディタで見ると以下のような感じになります

ファイルを保存すると外部ライブラリとして認識されるようになります
設定前は、以下のように Project Properties ウィンドウの API Versioning カテゴリ内 Public Packages には該当するパッケージ名が表示されていません
(Public Packages は、所有するパッケージを自モジュール以外からも利用可能なように設定する項目です)

設定後には以下のように表示されるようになります

ビルド後、以下のように Jar がコピーされます

以上の手順で Library Wrapper Module を用いずに外部 Jar ファイルが利用できるのですが、この挙動については各バージョンによって少し異なるようです
特に理由がなければ、 Library Wrapper Module の使用をお勧めします
0 件のコメント:
コメントを投稿