用于Maven进行条件检出或从SVN更新的设置? [英] Settings for Maven for conditional checkout or update from SVN?

查看:147
本文介绍了用于Maven进行条件检出或从SVN更新的设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在POM文件中有以下设置.但是我的构建脚本失败并显示``SVN文件已锁定''消息.是否还有其他方法可以进行条件检出.如果项目已检出,则仅在项目为没有签出,应该签出代码,并且不应该更新代码.谢谢.

I have following settings in POM file.But my build script fails with 'SVN file locked' message.Is there any other way to do conditional checkout.If project is already checked out then I want to update only otherwise if project is not checkedout it should check out the code and should not update it.Thanks in advance.

      <!-- Initial check out of  (will not do anything if directory already there) -->
      <execution>
        <id>check-out-project</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>checkout</goal>
        </goals>
        <configuration>
          <checkoutDirectory>${project.build.directory}/project</checkoutDirectory>
          <connectionUrl>scm:svn:http://XX:XX/svn/repos/${XX}</connectionUrl>
          <username>${svn.username}</username>
          <password>${svn.password}</password>
          <skipCheckoutIfExists>true</skipCheckoutIfExists>
        </configuration>
      </execution>
      <!-- Update project (if directory was already there) -->
      <execution>
        <id>update-project</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>update</goal>
        </goals>
        <configuration>
          <basedir>${project.build.directory}/project</basedir>
          <connectionUrl>scm:svn:http://XXX:XXX/svn/repos/${project}</connectionUrl>
          <username>${svn.username}</username>
          <password>${svn.password}</password>
          <revisionKey>project.revision</revisionKey>
        </configuration>
      </execution>

运行maven后的错误日志(请注意,我已用xxxx替换目录路径和url)

Error log after running maven (Please note I have replaced directory paths and urls with xxxx)

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building xxxxxx.and.xxxxxx 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-xxxxxx-xxxxxx) @ xxxxxx.and.
xxxxxx ---

[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-sat) @ xxxxxx.and.xxxxxx ---

[INFO]
[INFO] --- maven-scm-plugin:1.4:checkout (check-out-xxxxxx) @ xxxxxx.and.xxxxxx --
-

[INFO] Removing x:\xxxx\xxxx\target\xxxxxx

[INFO] Executing: cmd.exe /X /C "svn --username xxxx --password ***** --no-aut
h-cache --non-interactive checkout http://xxxx:xxx/svn/repos/xxxx/xxx x:\
projects\xxxx\target\xxxxxx"

[INFO] Working directory: x:\xxxx\xxxx\target

[INFO]

[INFO] --- maven-scm-plugin:1.4:update (update-xxxxxx) @ xxxxxx.and.xxxxxx ---

[INFO] Executing: cmd.exe /X /C "svn --username xxxx --password ***** --no-aut
h-cache --non-interactive update x:\xxxx\xxx\target\xxxxxx"

[INFO] Working directory: x:\xxx\xxx\target\xxxxxx

[INFO] Svn command failed due to some locks in working copy. We try to run a 'sv
n cleanup'.

[INFO] Executing: cmd.exe /X /C "svn"

[INFO] Working directory: x:\xxx\xxxx\target\xxxxxx

[ERROR] Provider message:

[ERROR] The svn command failed.

[ERROR] Command output:

[ERROR] svn: Working copy 'x:\xxxx\xxxx\target\xxxxxx' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
Type 'svn help' for usage.


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 8:03.303s

[INFO] Finished at: Thu Apr 28 17:24:50 BST 2011

[INFO] Final Memory: 4M/15M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.4:upd
ate (update-xxxxxx) on project xxxxxx.and.xxxxxx: Command failed.The svn command f
ailed. -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.

[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 rea
d the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

推荐答案

首次运行

mvn clean

运行之后

mvn scm:update

这篇关于用于Maven进行条件检出或从SVN更新的设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆