我尝试运行mvn release:prepare(当然,发布后:clean),我收到错误:
无法执行目标org.apache.maven.plugins:maven-release-plugin:2.5:prepare(default-cli)...:编写POM时出错:D:\\ pom.xml(Access是拒绝)
引起:java.io.FileNotFoundException:D:... \ pom.xml(访问被拒绝)
问题:文件位于指定位置,但它是写保护的(因为它在SCM下)。所有的poms必须签到,否则我会在早期阶段(check-poms阶段)收到错误。所以pom必须签入,即写保护,因此我得到了#34;访问被拒绝"例外,它没有任何意义!
在下载了maven源码scm-plugin和release-plugin之后,我试图找到一些东西,但遗憾的是找不到这个异常的原因。也许我错过了一些东西,所以我在这里张贴,也许有人可以解释一下。
我已经在代码中的几个点添加了日志(在DefaultReleaseManager中,所以我可以看到相位),重新构建并且我看到它在相位上失败,称为' rewrite-poms -for-release ',这是maven尝试将我的poms改为发布的阶段,并再次检查它们。但问题是这些poms受源代码控制,所以它们只读。所以插件无法写入这些poms,因此它会返回错误' access denied'。
试图查看相关课程中是否有某些内容class RewritePomsForReleasePhase extends AbstractRewritePomsPhase
,但一无所获。试图用-X运行它,所以我得到了相关的例外(见下文)。
我使用maven-release-plugin:2.5,maven-scm-plugin:1.9,提供者是TFS(但是我不知道它与我的错误有什么关系,因为它没有在&#39中失败;提供者'或在scm-plugin中。)
更新:
尝试使用maven-release-plugin重现:2.1,我知道这肯定有效(使用maven-scm:1.4)。我犯了同样的错误。所以我想我的配置中的某些内容是不正确的......也许这里有专家可以提供帮助吗?也许它与maven-scm-plugin有关?
[INFO] Command line - cmd.exe /X /C "tf status -workspace:ohad -recursive -format:detailed $/NNG/PLS/dev/PLS/PLR"
[DEBUG] line -There are no pending changes.
[INFO] err -
[DEBUG] Iterating
[INFO] *** DefaultReleaseManager(): phase name= check-dependency-snapshots
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] *** DefaultReleaseManager(): phase name= create-backup-poms
[INFO] *** DefaultReleaseManager(): phase name= map-release-versions
What is the release version for "referencedata"? (com.ccih:referencedata) ***: : 6.6.0-RELEASE
What is the release version for "referencedata.resolvertool"? ***: : 6.6.0-RELEASE
[INFO] *** DefaultReleaseManager(): phase name= input-variables
[INFO] scmUrl - https://***:$/***
[INFO] Scheme - https
What is SCM release tag or label for "referencedata"? ***: :
[INFO] *** DefaultReleaseManager(): phase name= map-development-versions
What is the new development version for "referencedata"? ***: :
What is the new development version for "referencedata.resolvertool"? ***: :
[INFO] *** DefaultReleaseManager(): phase name= rewrite-poms-for-release
[INFO] Transforming 'referencedata'...
[INFO] scmUrl - https://***:$/***R
[DEBUG] Using mirror nng (http://192.168.244.13:8081/artifactory/nng) for plt-release (http://192.168.244.13:8081/artifactory/plt-release-local).
[DEBUG] Using mirror nng (http://192.168.244.13:8081/artifactory/nng) for plt-snapshot (http://192.168.244.13:8081/artifactory/plt-snapshot-local).
[DEBUG] Extension realms for project com.ccih:ccih-platform-dependencies:pom:6.5.0600.0000: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] No SCM translator found - skipping rewrite
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] referencedata ..................................... FAILURE [2:16.083s]
[INFO] referencedata.resolvertool ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:16.696s
[INFO] Finished at: Thu May 22 15:55:20 IDT 2014
[INFO] Final Memory: 10M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project referencedata: Error writing POM: D:\<correct path>\pom.xml (Access is denied) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project referencedata:
Error writing POM: D:\Dev\projects\NNG\PLS\dev\PLS\PLR\pom.xml (Access is denied)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error writing POM: D:\Dev\projects\NNG\PLS\dev\PLS\PLR\pom.xml (Access is denied)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:281)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:232)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Error writing POM: D:\Dev\projects\NNG\PLS\dev\PLS\PLR\pom.xml (Access is denied)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:685)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:632)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:241)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:131)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:116)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:236)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:277)
... 22 more
Caused by: java.io.FileNotFoundException: D:\Dev\projects\NNG\PLS\dev\PLS\PLR\pom.xml (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at org.codehaus.plexus.util.xml.XmlStreamWriter.<init>(XmlStreamWriter.java:59)
at org.codehaus.plexus.util.WriterFactory.newXmlWriter(WriterFactory.java:117)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:666)
... 31 more
答案 0 :(得分:0)
它似乎是maven-scm-provider-tfs中的一个错误。这意味着,对maven-scm-plugin的TFS支持并不完整。
我为此打开了JIRA item [SCM-752],并建议修复。它将在maven-scm-plugin的下一个版本(1.10)中发布。