如何禁用maven发布插件检查本地修改?
我使用maven发布插件。在我的 pom 中存在和 Ant 任务,它自动修复一些具有附加信息的属性文件。此修复不应出现在 SCM 中。 但是maven没有成功完成,因为错误:
Cannot prepare the release because you have local modifications
Is it possible to set someparameters to don't check local revisions?
谢谢。
I use maven release plugin. In my pom exists and Ant task that automatically fix some properties files with additional information. This fixes should not be in SCM.
But maven don't finish with success for error:
Cannot prepare the release because you have local modifications
Does it possible to set some parameters to don't check local modifications?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我对 maven-release-plugin 不太熟悉,但我可以看到有一个 checkModificationExcludes 属性,您可以将其用于您的目的。配置应该有点像这样:
I'm not very familiar with maven-release-plugin, but I can see that there is a checkModificationExcludes property that you can use for your purpose. The config should be somewhat like this:
我们试图从 jenkins 运行版本,但它总是失败并显示相同的消息......
这很奇怪,因为我们在发布之前使用 jenkins 检查并构建最新的源代码。
我们最终发现问题在于我们是在 Windows 节点上构建的,并且某些文件路径太长,导致 maven-release-plugin 抱怨本地修改。切换到linux节点解决了这个问题。
We were trying to run the release from jenkins but it always failed with the same message...
... which was weird, because we use jenkins to check out and build the latest sources before releasing.
We finally figured out that the problem was that we were building on a Windows node and some file paths were too long which caused the maven-release-plugin to complain about local modifications. Switching to a linux node solved this problem.
从源代码管理中删除项目的
target
文件夹为我解决了这个问题。Removing my project's
target
folder from source control fixed this issue for me.我建议修复您的构建过程,以便它不会“修复”SCM 下的文件。有多种方法可以做到这一点,最简单的是将有问题的属性文件复制到
${project.build.outputDirectory}
下的某个目录,并在这些文件(而不是原始文件)上运行 Ant 脚本I would suggest fixing your build process, so that it does not 'fix up' files that are under SCM. There are several ways of doing this, the simplest is to copy properties files in question to some directory under
${project.build.outputDirectory}
, and run your Ant script on these files, rather than originals@AndrewLogvinov 的答案已经完成一半了。 这里提到了另一半 :
由于某些奇怪的原因,您不能在此标记中包含路径。您只能指定文件名。
@AndrewLogvinov's answer is half way there. The other half is mentioned in this:
For some weird reason, you can't include paths in this tag. You can only specify file names.
在我的例子中,通过将作业名称重命名为较短的长度(大约 20 个字符),它可以在 Windows 上运行。
就我而言,Jenkins 作业名称和 svn 分支名称较长(大约 40 个字符)。
如果某些文件路径太长,则会导致 maven-release-plugin 抱怨本地修改。 Jenkin 创建一个本地工作空间,其作业名称
为 For ,如下所示,Jenkins 作业在发布时将开始抱怨本地修改。
It worked on Windows in my case by renaming job name to a shorter length (About 20 characters).
In my case, Jenkins job name and also svn branch name were longer (About 40 characters).
If some file paths are too long it causes the maven-release-plugin to complain about local modifications. Jenkin creates a local workspace with the job name
e.g. For and as below, Jenkins job while releasing will start complaining about local modifications.