maven設定ファイルの指定方法はどのように行いますか?

Mavenの特定の設定ファイルを使用するには、-sパラメーターをコマンドラインで指定します。例:

mvn clean install -s /path/to/settings.xml

Mavenのconfディレクトリにsettings.xmlファイルを作成し、永続的に設定ファイルを指定したい場合は、その中で使用する設定ファイルのパスを指定します。例えば:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
    <localRepository>${user.home}/.m2/repository</localRepository>
  
    <servers>
        <!-- server definitions -->
    </servers>
  
    <mirrors>
        <!-- mirror definitions -->
    </mirrors>
  
    <profiles>
        <profile>
            <id>my-settings</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <maven.settings.file>/path/to/settings.xml</maven.settings.file>
            </properties>
        </profile>
    </profiles>
  
</settings>

そのため、Mavenは指定されたsettingsファイルをデフォルトで使用します。

コメントを残す 0

Your email address will not be published. Required fields are marked *


广告
広告は10秒後に閉じます。
bannerAds