2

スナップショットとリリース (つまり、リリースの場合はhttp://example.org 、スナップショットの場合はhttp://dev.example.org ) で異なる Maven プロジェクトの階層のサイトをデプロイし、プロジェクト階層 (親、子、モジュール) 適切なリンクで修正します。

私の試みは、「現在の」サイト情報を保持するためのプロパティと、考えられる各タイプのサイト (dev、stable など) を保持するためのプロパティを割り当てることでした。次に、プロファイルを使用して、リリース時にサイト情報を切り替えます。以下は、私が言いたいことの例です。

親 POM スニペット:

<project>
...

    <url>http://${site.host}/</url>

    <properties>
        <site.host.stable>example.org</site.host.stable>
        <site.host.stable.desc>PARENT-STABLE</site.host.stable.desc>

        <site.host.dev>dev.example.org</site.host.dev>
        <site.host.dev.desc>PARENT-DEV</site.host.dev.desc>

        <site.host>${site.host.dev}</site.host>
        <site.host.other>${site.host.stable}</site.host.other>
        <site.host.other.desc>${site.host.stable.desc}</site.host.other.desc>
    </properties>

    <distributionManagement>
        <site>
            <id>site-deploy-id</id>
            <url>.../var/www/${site.host}</url>
        </site>
    </distributionManagement>

    <profiles>
        <profile>
            <id>example-release</id>
            <properties>
                <site.host>${site.host.stable}</site.host>
                <site.host.other>${site.host.dev}</site.host.other>
                <site.host.other.desc>${site.host.dev.desc}</site.host.other.desc>
            </properties>
        </profile>
    </profiles>

...
</project>

親サイト記述子の例:

<project>
    <body>
        <links>
            <item name="${site.host.other.desc}" href="http://${site.host.other}" />
        </links>
    </body>
</project>

子サイト記述子の例:

<project>
    <body>
        <menu ref="parent"/>
    </body>
</project>

これの配布管理部分は完全に機能し、期待どおりにファイルを展開します (アクティブなプロファイルに基づいて、ターゲット マシンの適切なディレクトリに)。

実際のサイト パーツの場合:

サイト プラグインのバージョン 2.2 では、これは親サイトでは正常に機能しますが、指定されたリリース プロファイルがアクティブであっても、すべての子孫サイトはスナップショットまたは「開発」バージョンに戻ります。サイト プラグインのバージョン 3.0 では、次のメッセージが出力され、(前述のように) 親メニューは作成されません。リンク セクションはバージョン 2.2 のように機能します。

[WARNING] Unable to find a URL to the parent project. The parent menu will NOT be added.

codehaus の properties-maven-plugin を使用すると、プロファイル プロパティが正しく適用されていることがわかりますが、サイト プラグインはこれを無視しているようです。

私がやろうとしていることを達成するためのより良い方法はありますか? これはバグですか、それともどこかで間違いを犯しましたか?

4

0 に答える 0