Maven的版本:准备IOException异常(maven release:prepare IOE

2019-09-18 01:49发布

我试图让Maven的发布插件与Perforce的工作。 当我运行:

mvn release:prepare -Dusername=PerforceUser -Dpassword=PerforcePassword

我得到这个输出(除去一些IP地址/用户名/密码):

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:                                                                                         [INFO]
[INFO] root-project
[INFO] project1
[INFO] project2
[INFO] project3
[INFO] project4
[INFO] project5
[INFO] project6
[INFO] project7
[INFO] project8
[INFO] project9
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building root-project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.3.1:prepare (default-cli) @ root-project ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.bran
ch, **\pom.xml.tag
[ERROR] Path 'D:\Server\pom.xml' is not under client's root '/cygdrive/d/Server'.
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "root-project"? (com.company:root-project) 1.0: :
What is SCM release tag or label for "root-project"? (com.company:root-project) root-project-1.0: :
What is the new development version for "root-project"? (com.company:root-project) 1.1-SNAPSHOT: :
[INFO] Transforming 'root-project'...
[INFO]   Updating project8 to 1.0
[INFO]   Updating project4 to 1.0
[INFO]   Updating project1 to 1.0
[INFO]   Updating project3 to 1.0
[INFO]   Updating project6 to 1.0
[INFO]   Updating project7 to 1.0
[INFO]   Updating project9 to 1.0
[INFO]   Updating project5 to 1.0
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
    at java.io.WinNTFileSystem.canonicalize0(Native Method)
    at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
    at java.io.File.getCanonicalPath(File.java:559)
    at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.createCommandLine(PerforceEditCommand.java:109)
    at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.executeEditCommand(PerforceEditCommand.java:51)
    at org.apache.maven.scm.command.edit.AbstractEditCommand.executeCommand(AbstractEditCommand.java:40)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.perforce.PerforceScmProvider.edit(PerforceScmProvider.java:210)
    at org.apache.maven.scm.provider.AbstractScmProvider.edit(AbstractScmProvider.java:560)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:631)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:125)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:110)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
    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:291)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    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:319)
    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: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: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)
[ERROR] CommandLineException Exit code: 1 - Usage: add/edit/delete [-c changelist#] [ -d -f -k -n -v ] [-t type] files...
Missing/wrong number of arguments.

Command line was:p4 -d D:\Server -p *The-IP-of-Perforce* -u *PerforceUser* -P *PerforcePassword* edit
org.codehaus.plexus.util.cli.CommandLineException: Exit code: 1 - Usage: add/edit/delete [-c changelist#] [ -d -f -k -n -v ] [-t type] files...
Missing/wrong number of arguments.

Command line was:p4 -d D:\Server -p *The-IP-of-Perforce* -u *PerforceUser* -P *PerforcePassword* edit
    at org.apache.maven.scm.provider.perforce.command.edit.PerforceEditCommand.executeEditCommand(PerforceEditCommand.java:71)
    at org.apache.maven.scm.command.edit.AbstractEditCommand.executeCommand(AbstractEditCommand.java:40)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.perforce.PerforceScmProvider.edit(PerforceScmProvider.java:210)
    at org.apache.maven.scm.provider.AbstractScmProvider.edit(AbstractScmProvider.java:560)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.writePom(AbstractRewritePomsPhase.java:631)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:125)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:110)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
    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:291)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    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:319)
    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: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: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)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] root-project ........................................ FAILURE [22.348s]
[INFO] project1 ............................................ SKIPPED
[INFO] project2 ............................................ SKIPPED
[INFO] project3 ............................................ SKIPPED
[INFO] project4 ............................................ SKIPPED
[INFO] project5 ............................................ SKIPPED
[INFO] project6 ............................................ SKIPPED
[INFO] project7 ............................................ SKIPPED
[INFO] project8 ............................................ SKIPPED
[INFO] project9 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.967s
[INFO] Finished at: Tue Jun 12 15:41:53 BST 2012
[INFO] Final Memory: 8M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.1:prepare (default-cli) on project root-project: Error writing POM: D:\Server\pom.xml (Access is denied) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

发生这种情况时,都在我的cygwin运行它,当我在一个正常的原生Windows命令提示符下运行。

我得到这个远在安装之前,我确信它成功地写出的版本到POM至少一次,但现在没有。

Answer 1:

纵观行家SCM提供商Perforce的源代码,我可以看到,上线93它创建的基本P4命令行

Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );

然后在第95行把它添加编辑

command.createArg().setValue( "edit" );

然后在try-catch里面添加的文件。 但线109

串canfile = file.getCanonicalPath();

抛出上述导致堆栈跟踪看到IOException异常要打印的,这就是为什么该文件(S)没有得到补充和P4命令执行失败(这反过来又导致了“访问被拒绝”,因为它无法结账该文件(因此这是只读)。

编辑:

它抛出IOException异常的原因是,当它创造上线103文件:

File file = new File( workingDirectory, fs.get( i ).getPath() );

fs.get( i ).getPath()返回一个绝对路径,那么文件最终看起来像

D:\Server\D:\Server\pom.xml (in my case)

这显然打破。

我已经改变了行(并以类似的线PerforceCheckInCommand.java本地到:

File file = null;
if(fs.get( i ).isAbsolute()) file = new File( fs.get( i ).getPath() );
else file = new File( workingDirectory, fs.get( i ).getPath() );

并重新安装插件,现在所有的作品。 所以,问题是在插件引起我特别的安装失败的错误。 我已经提交bug报告,所以希望没有人会遇到这种现象,但如果他们这样做,下载插件SRC,使这两个变化和重新安装(安装MVN),它应该工作。



文章来源: maven release:prepare IOException