2011-09-06 61 views
1

Maven我只想在工件尚未安裝到存儲庫時執行構建。我的想法是使用默認情況下處於非活動狀態的配置文件,但是如果工件丟失,它將被激活。 到目前爲止,我沒有成功,因爲它似乎Maven屬性不能用於配置文件激活?Maven:根據localRepository屬性激活配置文件?

的settings.xml:

... 
<localRepository>/local/m2repo</localRepository> 
... 

1)本作品:

的pom.xml:

... 
<profile> 
    <id>my-profile</id> 
    <activation> 
     <activeByDefault>false</activeByDefault> 
     <file> 
      <missing>/local/m2repo/something</missing> 
     </file> 
    </activation> 
    ... 
</profile> 

2)這不工作:

的pom.xml :

... 
<profile> 
    <id>my-profile</id> 
    <activation> 
     <activeByDefault>false</activeByDefault> 
     <file> 
      <missing>${settings.localRepository}/something</missing> 
     </file> 
    </activation> 
    ... 
</profile> 

3)這也不行:

的settings.xml:

... 
<properties> 
    <local.repository>${settings.localRepository}</local.repository> 
</properties> 
... 

的pom.xml:

<profile> 
    <id>my-profile</id> 
    <activation> 
     <activeByDefault>false</activeByDefault> 
     <file> 
      <missing>${local.repository}/something</missing> 
     </file> 
    </activation> 
</profile> 

是否有某種方式解決方法或替代我怎麼能檢查我的神器的存在,只在必要時運行一個構建? 感謝您的任何想法!

回答

0

你不能那樣做。

激活文件位置通常是相對於當前項目文件夾。

只有在配置文件已經定義並開始構建之後,纔會計算屬性。

相關問題