在git存储库顶层的文件夹中,maven-release-plugin deploy目标失败 [英] maven-release-plugin deploy goal fails on project with folder at top level in git repository

查看:261
本文介绍了在git存储库顶层的文件夹中,maven-release-plugin deploy目标失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

 父项目文件夹
- -----> pom.xml
------> Child 1项目文件夹
------> ------> pom.xml
------> Child 2项目文件夹
------> ------> pom.xml

我们现在试图使用maven-release-plugin来发布代码。



运行'mvn release:prepare release:perform'时,准备阶段工作正常,但是当执行阶段运行时,我们得到以下错误:

  [INFO] --- maven-release-plugin:2.0:perform(default-cli)@ PARENTPROJECT --- 
[INFO]检出项目以执行释放...
[INFO]执行:cmd.exe / X / Cgit clone ssh://GITREPO.gitC:\\\Jenkins\\ \\ jobs\test 6\workspace\Parent项目文件夹\目标\签出

[信息]工作目录:C: 6 \workspace\Parent项目文件夹\目标
[INFO]执行:cmd.exe / X / Cgit fetch ssh://GITREPO.git
[INFO]工作目录:C :\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout
[I NFO]执行:cmd.exe / X / Cgit checkout PARENTPROJECT-0.0.0.0.2
[INFO]工作目录:C:\\\\\Jenkins\jobs\test 6\workspace \项目文件夹\目标\签出
[INFO]执行:cmd.exe / X / Cgit ls-files
[INFO]工作目录:C:\ CI \ Jenkins \jobs\test 6\workspace\Parent项目文件夹\target\checkout
[INFO]执行目标'deploy'...
[警告] Maven将在交互模式,但没有为此MavenInvoker实例配置输入流。
[INFO] [INFO]扫描项目...
[信息] [信息] ------------------------ ------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------ ------------------------------------------
[INFO] [ INFO]总时间:0.063s
[INFO] [INFO] Finished at:Fri Feb 07 15:07:26 GMT 2014
[INFO] [INFO] Final Memory:1M / 15M
[INFO] [INFO] -------------------------------------------- ----------------------------
[信息] [错误]您指定的目标需要执行一个项目,但有在这个目录下没有POM(C:请
验证您是否从正确的目录中调用了Maven。 - > [Help 1]

查看C:\\\Jenkins\jobs\测试6\workspace\Parent项目文件夹\target\checkout文件夹,那里确实没有POM文件。这是因为'git checkout'已经签出了创建的标签,这是针对'Parent project folder'。



因此,在结帐文件夹中,我们有'父项目文件夹'并且没有POM文件,因为POM存在于'父项目文件夹'中,而不是存储库顶层的权限。



我们知道解决方案这个问题可能是将POM移动到存储库顶层(即Parent项目文件夹之外),但想探索是否有其他解决方案。



我们在SVN中有一个类似的项目设置,并且发布插件工作正常。这似乎是因为当标签被创建时,只有'Parent project folder'内的内容出现在标签中,所以POM被签出到目标中。在git中,实际的'父项目文件夹'被标记了,所以这被检出到目标中,并且POM在其中生存。



实际上我们可以做什么运行release插件来告诉它运行目标,比如从'C:\\\\\\\\\\\\\\\\\\\\\\\\\\'文件夹'而不是'C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\' >我认为这是一个很长的一步,但认为这是值得提出的问题。

所以如果我正确地阅读你的话,它听起来像问题是,当释放:执行使其内部调用 mvn部署它找不到父pom文件,因为它被埋在子目录的更深层次。



然后解决方案是告诉内部调用在哪里找到t他的文件:

  mvn release:执行

  mvn release:perform -Dgoals ='deploy -f parent_project_folder / pom .xml'

希望有所帮助。


We have a Maven project structured in a GIT repository with the following folders:

Parent project folder
------> pom.xml
------> Child 1 project folder
------> ------> pom.xml
------> Child 2 project folder
------> ------> pom.xml

We are now trying to use the maven-release-plugin in order to go releases of the code.

When running 'mvn release:prepare release:perform', the prepare phase works fine but when the perform phase runs we get the following error:

[INFO] --- maven-release-plugin:2.0:perform (default-cli) @ PARENTPROJECT ---
[INFO] Checking out the project to perform the release ...
[INFO] Executing: cmd.exe /X /C "git clone ssh://GITREPO.git "C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout"
"
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target
[INFO] Executing: cmd.exe /X /C "git fetch ssh://GITREPO.git"
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout
[INFO] Executing: cmd.exe /X /C "git checkout PARENTPROJECT-0.0.0.0.2"
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout
[INFO] Executing: cmd.exe /X /C "git ls-files"
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout
[INFO] Executing goals 'deploy'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 0.063s
[INFO] [INFO] Finished at: Fri Feb 07 15:07:26 GMT 2014
[INFO] [INFO] Final Memory: 1M/15M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout). Please
 verify you invoked Maven from the correct directory. -> [Help 1]

When looking in the C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout folder, there is indeed no POM file in there. This is because the 'git checkout' has checked out the tag that was created which is against the 'Parent project folder'.

Therefore, within the checkout folder, we have 'Parent project folder' and no POM file because the POM lives within 'Parent project folder' rather than right at the top level of the repository.

We know that a solution to this problem would be to move the POM to right at the top level of the repository (i.e. outside of 'Parent project folder') but would like to explore if there any alternative solutions.

We have a similar setup of a project in SVN and the release plugin works fine. This seems to be because when the tag is created, only the contents within 'Parent project folder' appear in the tag so the POM is checked out into target. In git the actual 'Parent project folder' is tagged and so this is checked out into target and the POM lives within that.

Is there anything that we can do when actually running the release plugin to tell it to run goals such as deploy to run from 'C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout\Parent project folder' rather than 'C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout'?

I expect this is a long shot but thought it would be worth asking.

解决方案

So if I'm reading you correctly, it sounds like the problem is that when release:perform makes its inner call mvn deploy it can't find the parent pom file because it's buried one level deeper in a subdir.

The solution then is to tell the inner call where to find the pom file:

mvn release:perform

to

mvn release:perform -Dgoals='deploy -f parent_project_folder/pom.xml'

Hope that helps.

这篇关于在git存储库顶层的文件夹中,maven-release-plugin deploy目标失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆