1

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コマンドプロンプトで実行した場合の両方で発生します。

セットアップをここまで進める前は、少なくとも1回はバージョンをpomに書き込むことができたと確信していましたが、現在はそうではありません。

4

1 に答える 1

3

perforceソースコードのmavenscmプロバイダーを見ると、93行目で基本的なp4コマンドラインが作成されていることがわかります。

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

次に95行目に編集を追加します

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

次に、try-catch内にファイルを追加します。しかし109行目

文字列canfile=file.getCanonicalPath();

上記のIOExceptionをスローすると、スタックトレースが出力されます。これが、ファイルが追加されず、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() );

プラグインを再インストールすると、すべて機能します。したがって、問題はプラグインのバグであり、特定のセットアップが失敗します。私はバグレポートを提出したので、他の誰もこれを経験しないことを願っていますが、経験した場合は、プラグインsrcをダウンロードし、これら2つの変更を加えて再インストールし(mvn install)、動作するはずです。

于 2012-06-15T09:27:40.643 に答える