![无法在 TeamCity 中运行构建](https://linux22.com/image/588765/%E6%97%A0%E6%B3%95%E5%9C%A8%20TeamCity%20%E4%B8%AD%E8%BF%90%E8%A1%8C%E6%9E%84%E5%BB%BA.png)
我的 TeamCity 项目的某些配置有问题。我试图构建一个应用程序来运行其单元测试,但我做不到。
看来我的项目在从 git 获取源代码时遇到了问题,git 是一个私人仓库:
Build 'Myproject :: Build Myproject' #15
Started 'Fri Jun 29 12:41:28 EDT 2012' on 'Default Agent' by 'you'
Finished 'Fri Jun 29 12:41:47 EDT 2012' with status 'ERROR Unable to collect changes'
TeamCity URL http://ieditedthispart.compute-1.amazonaws.com:8111/viewLog.html?buildId=16&buildTypeId=bt2
TeamCity server version is 7.0.3 (build 21424)
[12:41:29]: bt2
[12:41:29]: Checking for changes
[12:41:47]: [PREPARATION_FAILURE_TYPE]
[12:41:47]: Failed to start build
[12:41:47]: Failed to collect changes, error: 'git fetch' command failed.
stderr: java.lang.OutOfMemoryError: Java heap space
at org.eclipse.jgit.storage.pack.BinaryDelta.apply(BinaryDelta.java:163)
at org.eclipse.jgit.storage.pack.BinaryDelta.apply(BinaryDelta.java:118)
at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:561)
at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:544)
at org.eclipse.jgit.transport.PackParser.resolveDeltas(PackParser.java:507)
at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:462)
at org.eclipse.jgit.storage.file.ObjectDirectoryPackParser.parse(ObjectDirectoryPackParser.java:178)
at org.eclipse.jgit.transport.PackParser.parse(PackParser.java:410)
at org.eclipse.jgit.transport.BasePackFetchConnection.receivePack(BasePackFetchConnection.java:649)
at org.eclipse.jgit.transport.BasePackFetchConnection.doFetch(BasePackFetchConnection.java:280)
at org.eclipse.jgit.transport.TransportHttp$SmartHttpFetchConnection.doFetch(TransportHttp.java:64...
[12:41:47]: Build finished
如您所见,正在发出有关 Java 内存不足的警报,但这没有意义,因为它运行时的堆大小至少为 1300MB。
答案1
这似乎是启动 TeamCity 时 JAVA 堆大小或内存选项的问题。
我必须设置以下环境变量:
export TEAMCITY_SERVER_MEM_OPTS="-Xmx1300m -XX:MaxPermSize=270m"
export TEAMCITY_SERVER_OPTS="-Dteamcity.git.fetch.separate.process=false"