如何将scm connnectionurl从外部文件导入pom.xml?

时间:2011-09-21 11:18:20

标签: maven

我希望获取connectionUrl和其他属性(例如modules)以将外部文件(不一定是xml文件)中的存储库签出到pom文件中。

我的pom文件如下:

<project>...
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-scm-plugin</artifactId>
       <version>1.5</version>
       <configuration>
         <username>${svn.username}</username>
         <password>${svn.pass}</password>`enter code here`
         <checkoutDirectory>${path}</checkoutDirectory>
         <skipCheckoutIfExists/>
       </configuration>
       <executions>
         <execution>
           <id>checkout_a</id>
           <configuration>
             <connectionUrl>I want to get the url and other properties from a xml file</connectionUrl>
             <checkoutDirectory>${path}</checkoutDirectory>
           </configuration>
           <phase>process-resources</phase>
             <goals>
               <goal>checkout</goal>
             </goals>
        </execution>
      </executions>
  </plugin>     
</plugins>
</build>
</project>

2 个答案:

答案 0 :(得分:1)

使用属性插件read pom properties from a properties file。如果不是属性文件,那么您可能需要使用GMaven,编写一些groovy代码来解析文件,然后自己更新pom属性。

答案 1 :(得分:0)

最简单的方法是将svn url声明为pom.xml中的属性,如this (french) articletranslated here)中所示。

<connection>scm:svn:http://my.svn.server/trunk</connection> 

但是,与此thread illustrates一样,您无法获得“当前”回购(通过svn info)。

你可以看到here for an scm ClearCase URL

scm:clearcase<delimiter>[viewName]<delimiter>[loadCommand]<delimiter>[VOBName]<delimiter>[streamName]<delimiter>/main/fooBar/LATEST
相关问题