在我的项目中,我们必须使用maben-build-number插件来构造jar的最终名称,为此我们使用SCN的修订版,所以我们需要SCM
但是我们在受控环境中有两个SVN,没有直接访问和我们的本地测试环境,所以对于我们的pouproses我们必须使用:
<scm>
<connection>scm:svn:http://dev.com/svn_repo/trunk</connection>
<developerConnection>scm:svn:https://dev.com/svn_repo/trunk</developerConnection>
<url>http://dev.com/view.cvs</url>
</scm>
但对于客户环境:
<scm>
<connection>scm:svn:http://client.com/svn_repo/trunk</connection>
<developerConnection>scm:svn:https://client.com/svn_repo/trunk</developerConnection>
<url>http://client.com/view.cvs</url>
</scm>
是否可以在不同的配置文件中进行配置。我试过了
<profiles>
<profile>
<id>local</id>
<scm>
<connection>scm:svn:http://client.com/svn_repo/trunk</connection>
<developerConnection>scm:svn:https://client.com/svn_repo/trunk</developerConnection>
<url>http://client.com/view.cvs</url>
</scm>
</profile>
<profile>
<id>remote</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<scm>
<connection>scm:svn:http://client.com/svn_repo/trunk</connection>
<developerConnection>scm:svn:https://client.com/svn_repo/trunk</developerConnection>
<url>http://client.com/view.cvs</url>
</scm>
</profile>
</profiles>
但是当我使用配置文件-Plocal时,没有任何反应?
答案 0 :(得分:2)
我通过为需要为不同配置文件更改的SCM连接详细信息创建属性来解决此问题。这是我所做的摘要。
定义属性,并且默认值为属性块。
<properties>
<developerConnectionUrl><!-- developerConnection url here --></developerConnectionUrl>
</properties>
设置scm块属性以使用全局属性。
<scm>
<developerConnection>${developerConnectionUrl}</developerConnection>
</scm>
创建了一个配置文件,该配置文件可根据需要更改全局属性。
<profiles>
<profile>
<id>local</id>
<properties>
<developerConnectionUrl><!-- developerConnectionUrl url for profile --></developerConnectionUrl>
</properties>
</profile>
</profiles>
据我所知,通过对模式的快速扫描,scm
标记只能在POM的顶层使用,而在profile
标记内部则无效