'svn'不被视为内部或外部命令

时间:2012-12-17 14:16:06

标签: svn maven cmd

当我尝试在net beans IDE上构建我的maven应用程序时,我收到此错误,可以随时帮助我。

Checking for local modifications: skipped.
Executing: cmd.exe /X /C "svn --non-interactive update D:\server"
Working directory: D:\server
Provider message:
The svn command failed.
Command output:
'svn' is not recognized as an internal or external command,
operable program or batch file.

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.070s
Finished at: Mon Dec 17 19:24:19 IST 2012
Final Memory: 15M/175M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.1:create (default) on project red5-server: Couldn't update project. Error! -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

2 个答案:

答案 0 :(得分:13)

我看到你正在执行这一行:

cmd.exe /X /C "svn --non-interactive update D:\server

这意味着在%PATH%变量中设置的任何目录中都找不到svn.batsvn

您的Windows系统上是否安装了Subversion?如果你使用了Sublab的CollabNet版本,那么它应该自动更新你的PATH以在你的%PATH%变量中加入C:\Program Files\Subversion\bin或类似的东西。如果没有,请打开系统控制面板,转到高级选项卡,然后单击设置环境变量。找到PATH环境变量并添加svn.exe程序所在的目录。

如果您尚未安装Subversion,请从CollabNet,SlikSVN或Wandisco安装。

答案 1 :(得分:10)

您应该使用javasvn提供商。这样,您的构建/发布将不依赖于SVN客户端的本地安装和设置env变量。

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.2.2</version>
        <dependencies>
            <dependency>    
                <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
                <artifactId>maven-scm-provider-svnjava</artifactId>
                <version>1.6</version>
            </dependency>
        </dependencies>
        <configuration>
            <providerImplementations>
                <svn>javasvn</svn>
            </providerImplementations>
            <goals>deploy</goals>
            <tagBase>https://svn.somedomain/project/tags</tagBase>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <tagNameFormat>project-@{project.version}</tagNameFormat>
        </configuration>
</plugin>