禁用Maven内部版本号插件

禁用Maven内部版本号插件

问题描述:

当前,我们正在从事大型Maven项目,该项目包含大约100个模块,其中一些模块还具有子模块.一些模块使用Maven内部版本号插件.该项目位于Subversion下.

Currently we are working on the big maven project that has about 100 modules, some of them have submodules as well. Some of modules use Maven Build Number plugin. The project is hosted under subversion.

最近,我们开始在我们的开发团队中本地使用git.克隆Subversion存储库并尝试构建Project后,我们收到以下众所周知的错误:

Recently we started to use git locally in our development team. After cloning subversion repo and trying to build the Project, we received following well known error:

The svn command failed.
Command output:
svn: ‘.’ is not a working copy

不幸的是,在我们的情况下,不能选择创建新的配置文件或仅从POM中删除插件定义(这将使数百个POM文件混乱).我发现以下文章 http://abstractionextraction.wordpress.com/2012/09/27/git-svn-vs-maven-build-number-plugin/,但说实话,这不是我真正想做的事...

Unfortunately in our case it is not an option to create a new profile or just remove plugin definition from POM (this will follow to messing up hundreds of POM files). I found the following article http://abstractionextraction.wordpress.com/2012/09/27/git-svn-vs-maven-build-number-plugin/ but honestly, it's not something that I would really like to do...

有什么聪明的方法可以禁用此插件.像命令行参数一样?

Is there any smart way to disable this plugin. Like command-line parameter?

我认为您可以跳过获取修订而无需更改项目 pom.xml -

I think you may skip failure on obtain revision without change project pom.xml - buildnumber-maven-plugin has option revisionOnScmFailure which you may use like:

mvn -Dmaven.buildNumber.revisionOnScmFailure=no-scm package

在这种情况下,如果 scm 调用失败,将使用值 no-scm .当然,您可以更改它并提供其他任何字符串.

In that case value no-scm will be used if scm call was unsuccessful. Off course you may change it and provide any other string.