我在我的項目中使用了一個用於install4j的maven插件,位於here。該插件允許您使用<compilerVariables>
部分將變量傳遞給install4j。這是我的聚甲醛的相關章節:Maven:屬性不被替換
<plugin>
<groupId>com.google.code.maven-install4j</groupId>
<artifactId>maven-install4j-plugin</artifactId>
<version>0.1.1</version>
<configuration>
<executable>${devenv.install4jc}</executable>
<configFile>${basedir}/newinstaller/ehd.install4j</configFile>
<releaseId>${project.version}</releaseId>
<attach>false</attach>
<skipOnMissingExecutable>false</skipOnMissingExecutable>
<compilerVariables>
<property>
<name>m2_home</name>
<value>${settings.localRepository}</value>
</property>
</compilerVariables>
</configuration>
</plugin>
的問題是,$ {} settings.localRepository不被取代與實際目錄當我運行該插件。這是install4j正在生成的命令行腳本:
[INFO] Running the following command for install4j compile: /bin/sh -c /home/zach/install4j/bin/install4jc --release=9.1-SNAPSHOT --destination="/home/zach/projects/java/ehdtrunk/target/install4j" -D m2_home=${settings.localRepository} /home/zach/projects/java/ehdtrunk/newinstaller/ehd.install4j
這是插件的錯誤嗎?如果是這樣,需要改變以允許替代發生?
這是直線命令行Maven 2.而且,當在antrun插件中使用該屬性時,我會得到正確的輸出。看起來這可能是一個插件的問題。我會看看我是否知道antrun插件用這樣的屬性輸入做什麼,看看我是否可以將它應用到這個其他插件。 – UrLicht 2010-05-13 19:36:06
@jobrahms *看起來它可能是插件的問題*是的,我認爲是這樣。 – 2010-05-13 19:42:07
@jobrahms我用'mvn help:evaluate'測試了antrun以外的屬性,並確認它已正確解析。 – 2010-05-13 19:57:46