M2E(Maven)のproperty外部化

以前JavaFXのMaven設定を行った際にjfxrt.jarへのパスはpomに直接記載していた。別端末(別のパス)で使用しようとしたときに外部化した際の手順。

 

設定を記載するsetting.xmlを作成。(proxyを使う際等に既に作っていることも多い。)

Defaultは下。(自分はEclipseの設定->Maven->ユーザ設定から変更)

    The Maven install: $M2_HOME/conf/settings.xml
    A user's install: ${user.home}/.m2/settings.xml

作成した内容は以下。

profile -> propertiesの下に、キー、値を指定する。

(参考サイト

<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/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
    <profiles>
        <profile>
            <id>javafx2</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <javafx2.home>C:\develop\pleiades43\pleiades\java\7\lib\jfxrt.jar</javafx2.home>
            </properties>
        </profile>
    </profiles>
  <activeProfiles/>
</settings>

pomで直接記載していた個所が変数で指定できるようになっている。

 

     <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>javafx</artifactId>
            <version>2.0</version>
            <scope>system</scope>
            <systemPath>${javafx2.home}</systemPath>
        </dependency>

 

今回参考にさせてもらったビルドまで記載されているブログ

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です