你好的Maven/Perforce的專家,行家SCM不聽Perforce的觸發器輸出
我想實現的行家文物爲使用Perforce公司作爲VCS項目的自動版本。這使我選擇maven-scm-plugin和maven-release-plugin來達到我的目的。 我們在perforce中使用觸發器,它檢查每個提交的xml內容中的違規情況。
checkstyle_xml change-content //depot/project/....xml " /p4/triggers/checkstyle-trigger.pl %user% %changelist% /p4"
不幸的是,當我運行命令「MVN -X -e -B SCM:編輯版本:更新版本的SCM:籤」編輯文件,更新版本,並提交給Perforce的,Maven不包括尊重perforce觸發器的結果並且無法構建。但是,正如您所看到的,最終將該更改提交給perforce。
堆棧跟蹤使用XML其中有觸發有效
[DEBUG] Sending changelist:
Change: new
Description:
Auto increment pom version during build process. Reviewed by: RE
Files:
//depot/project/pom.xml
[ERROR] Provider message:
[ERROR] Unable to submit
[ERROR] Command output:
[ERROR] Debug: starting trigger script
Change 351157 submitted.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.112s
[INFO] Finished at: Thu Oct 30 14:51:51 PDT 2014
[INFO] Final Memory: 23M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.7:checkin (default-cli) on project phoenix: Command failed.Unable to submit -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.7:checkin (default-cli) on project phoenix: Command failed.Unable to submit
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Command failed.Unable to submit
at org.apache.maven.scm.plugin.AbstractScmMojo.checkResult(AbstractScmMojo.java:439)
at org.apache.maven.scm.plugin.CheckinMojo.execute(CheckinMojo.java:83)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
我提交的文件在本地,以確保Perforce的觸發不吐一個失敗狀態代碼,它實際上返回成功過。 我不確定爲什麼maven不會遵守perforce觸發器。
p4 –u testuser submit -d "Test" pom.xml
Submitting change 351166.
Locking 1 files ...
edit //depot/project/pom.xml#25
Debug: starting trigger script
Change 351166 submitted.
$ echo $?
0
我測試了其中沒有啓用Perforce的觸發和Maven構建返回結果作爲成功的一個txt文件的情形,因爲在技術上它不經過一個Perforce觸發器
堆棧跟蹤使用TXT WHICH可是沒有TRIGGER
[DEBUG] Sending changelist:
Change: new
Description:
Auto increment pom version during build process. Reviewed by: RE
Files:
//depot/phoenix/auto-increment-pom/pom.txt
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.998s
[INFO] Finished at: Thu Oct 30 14:55:04 PDT 2014
[INFO] Final Memory: 18M/216M
[INFO] ------------------------------------------------------------------------
問題:
- 有沒有人用maven體驗過這種行爲,你是如何解決這個問題的?
- 你會知道它是否可以禁用Perforce的觸發特定文件,使Perforce公司甚至沒有經過觸發
確定哪些文件激活哪些觸發由觸發器表中的「路徑」字段控制(請參閱'p4 help triggers')。 – 2014-10-31 00:01:37
謝謝..沒錯,但是觸發器查找任何xml模式,而且我不熟悉如何僅排除pom.xml。我可以在觸發器腳本中做到這一點,但我不想讓perforce甚至到達執行觸發器腳本的地步,如果它是pom.xml「checkstyle_xml change-content //depot/project/....xml」/ p4 /triggers/checkstyle-trigger.pl%user%%changelist%/ p4「' – user6930 2014-11-04 06:09:52
我發佈了一個關於如何從特定觸發器中排除單個文件的更多細節的答案。 – 2014-11-04 14:41:08