legacy-knowledge-base
公開されました Jul. 2, 2025

MavenでLiferayのテーマを作成する

written-by

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

この記事では、Liferay Maven SDKを使用してプロジェクトにテーマを追加する方法についてのガイドを掲載しています。

解像度

1. コマンドプロンプトまたはターミナルを開き、プロジェクトディレクトリに移動します。

2. 次に、Liferay platform theme template を使ってテーマを作成し、以下のコマンドを実行します:

mvn archetype:generate \
-DarchetypeArtifactId=liferay-theme-archetype \
-DarchetypeGroupId=com.liferay.maven.archetypes \
-DarchetypeVersion=6.1.0 \
-DartifactId=sample-theme \
-DgroupId=com.liferay.sample \
-Dversion=1.0-SNAPSHOT

これで、sample-themeディレクトリに、次のような構造のテーマプロジェクトができました。

sample-theme
sample-theme/pom.xml
sample-theme/src
sample-theme/src/main
sample-theme/src/main/resources
sample-theme/src/main/webapp
sample-theme/src/main/webapp/WEB-INF
sample-theme/src/main/webapp/WEB-INF/liferay-plugin-package.properties
sample-theme/src/main/webapp/WEB-INF/web.xml

2. テーマ pom.xml ファイルをプロパティから開く。 liferay.versionliferay.auto.deploy.dir のプロパティを削除しました。 これらのプロパティは、ポートレットプロジェクトで行ったのと同様に、プロジェクトルートの pom.xml で定義する必要があります。

また、 liferay.theme.parentliferay.theme.typeの2つのプロパティが追加されていることに注意する必要があります。 これらは、antベースのプラグインSDKと同様に、親テーマとテーマテンプレート言語を設定します。 しかし、 liferay.theme.parentというプロパティを使えば、基本的にどんな戦争の成果物も親として定義することができます。 構文は groupId:artifactId:version または、 _unstyled, _styled, classiccontrol_panelのコアテーマを使用することができます。

3. これで、カスタマイズした内容を src/main/webapp. _diffsで行っているのと同じ構造に従うだけです。 つまり、 custom.css は、 src/main/webapp/css/custom.cssに行くことになります。

4. カスタマイズが終わり、warファイルを作成したい場合は、次のように実行します:

mvn package

maven の war タイプのプロジェクトと同様に war ファイルが作成されます。 もうひとつは、親テーマをダウンロードしてコピーし、その上にあなたの変更を重ね合わせることです。 また、antベースのプラグインsdkが行うように、 src/main/webapp/images/screenshot.png からサムネイルを作成します。 これらは、generate-sourcesフェーズにtheme-mergeとbuild-thumbnailのゴールを追加することで実現されます。

5. 次に、このテーマをLiferayバンドルにデプロイするために、以下のコマンドを実行します:

mvn liferay:deploy

追加情報

Mavenのサポート方法については、 Fix Delivery Methodsのページを参照してください。

did-this-article-resolve-your-issue

legacy-knowledge-base