2017-10-12 59 views
0

我正在嘗試爲我的LibGdx項目設置VSTS構建。在我的VSTS構建定義中,我使用標準的Gradle構建步驟,構建失敗。從VSTS使用VSTS構建libgdx項目

我的堆棧跟蹤看起來是這樣的:

07:50:40.981 [INFO] [org.gradle.BuildLogger] Starting Build 
07:50:40.983 [DEBUG] [org.gradle.BuildLogger] Gradle user home: C:\java\gradle\user 
07:50:40.984 [DEBUG] [org.gradle.BuildLogger] Current dir: D:\a\1\s 
07:50:40.987 [DEBUG] [org.gradle.BuildLogger] Settings file: null 
07:50:40.988 [DEBUG] [org.gradle.BuildLogger] Build file: null 
07:50:41.019 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Starting to build the build sources. 
07:50:41.020 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Gradle source dir does not exist. We leave. 
07:50:41.024 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found env project properties: [] 
07:50:41.026 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found system project properties: [] 
07:50:41.725 [DEBUG] [org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator] No local repository in Settings file defined. Using default path: C:\Users\buildguest\.m2\repository 
07:50:42.170 [DEBUG] [org.gradle.initialization.ScriptEvaluatingSettingsProcessor] Timing: Processing settings took: 1.144 secs 
07:50:42.174 [INFO] [org.gradle.BuildLogger] Settings evaluated using empty settings script. 
07:50:42.368 [DEBUG] [org.gradle.initialization.ProjectPropertySettingBuildLoader] Looking for project properties from: D:\a\1\s\gradle.properties 
07:50:42.369 [DEBUG] [org.gradle.initialization.ProjectPropertySettingBuildLoader] project property file does not exists. We continue! 
07:50:42.371 [INFO] [org.gradle.BuildLogger] Projects loaded. Root project using empty build file. 
07:50:42.373 [INFO] [org.gradle.BuildLogger] Included projects: [root project 's'] 
07:50:42.733 [INFO] [org.gradle.configuration.project.BuildScriptProcessor] Evaluating root project 's' using empty build file. 
07:50:42.747 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 0.013 secs 
07:50:42.751 [INFO] [org.gradle.BuildLogger] All projects evaluated. 
07:50:42.781 [ERROR] [org.gradle.BuildExceptionReporter] 
07:50:42.783 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 
07:50:42.784 [ERROR] [org.gradle.BuildExceptionReporter] 
07:50:42.785 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 
07:50:42.786 [ERROR] [org.gradle.BuildExceptionReporter] Task 'build' not found in root project 's'. 
07:50:42.787 [ERROR] [org.gradle.BuildExceptionReporter] 
07:50:42.787 [ERROR] [org.gradle.BuildExceptionReporter] * Try: 
07:50:42.788 [ERROR] [org.gradle.BuildExceptionReporter] Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. 
07:50:42.790 [LIFECYCLE] [org.gradle.BuildResultLogger] 
07:50:42.791 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED 
07:50:42.792 [LIFECYCLE] [org.gradle.BuildResultLogger] 
07:50:42.793 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 10.167 secs 
07:50:42.801 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache artifact cache (C:\java\gradle\user\caches\modules-2) was closed 0 times. 
07:50:42.803 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 0 resolution results binary files in 0.0 secs 
07:50:42.805 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedRepositoryFactory] In-memory dependency metadata cache closed. Repos cached: 0, cache instances: 0, modules served from cache: 0, artifacts: 0 
Error: d:\a\1\s\7Seas\core\gradlew.bat failed with return code: 1 
    at ChildProcess.<anonymous> (d:\a\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\1.122.0\node_modules\vsts-task-lib\toolrunner.js:569:30) 
    at emitTwo (events.js:106:13) 
    at ChildProcess.emit (events.js:191:7) 
    at maybeClose (internal/child_process.js:886:16) 
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
##[error]Error: d:\a\1\s\7Seas\core\gradlew.bat failed with return code: 1 
##[section]Finishing: gradlew build 

我懷疑構建試圖在錯誤的目錄下執行「構建」命令。目前的目錄不應該是:D:\ a \ 1 \ s \ ProjName?

我gradle這個包裝文件是在這裏:

@if "%DEBUG%" == "" @echo off 
@rem ########################################################################## 
@rem 
@rem Gradle startup script for Windows 
@rem 
@rem ########################################################################## 

@rem Set local scope for the variables with windows NT shell 
if "%OS%"=="Windows_NT" setlocal 

set DIRNAME=%~dp0 
if "%DIRNAME%" == "" set DIRNAME=. 
set APP_BASE_NAME=%~n0 
set APP_HOME=%DIRNAME% 

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 
set DEFAULT_JVM_OPTS= 

@rem Find java.exe 
if defined JAVA_HOME goto findJavaFromJavaHome 

set JAVA_EXE=java.exe 
%JAVA_EXE% -version >NUL 2>&1 
if "%ERRORLEVEL%" == "0" goto init 

echo. 
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 
echo. 
echo Please set the JAVA_HOME variable in your environment to match the 
echo location of your Java installation. 

goto fail 

:findJavaFromJavaHome 
set JAVA_HOME=%JAVA_HOME:"=% 
set JAVA_EXE=%JAVA_HOME%/bin/java.exe 

if exist "%JAVA_EXE%" goto init 

echo. 
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 
echo. 
echo Please set the JAVA_HOME variable in your environment to match the 
echo location of your Java installation. 

goto fail 

:init 
@rem Get command-line arguments, handling Windows variants 

if not "%OS%" == "Windows_NT" goto win9xME_args 

:win9xME_args 
@rem Slurp the command line arguments. 
set CMD_LINE_ARGS= 
set _SKIP=2 

:win9xME_args_slurp 
if "x%~1" == "x" goto execute 

set CMD_LINE_ARGS=%* 

:execute 
@rem Setup the command line 

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 

@rem Execute Gradle 
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 

:end 
@rem End local scope for the variables with windows NT shell 
if "%ERRORLEVEL%"=="0" goto mainEnd 

:fail 
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 
rem the _cmd.exe /c_ return code! 
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 
exit /b 1 

:mainEnd 
if "%OS%"=="Windows_NT" endlocal 

:omega 

和我gradle-wrapper.properties文件:

#Thu Oct 12 08:51:38 CEST 2017 
distributionBase=GRADLE_USER_HOME 
distributionPath=wrapper/dists 
zipStoreBase=GRADLE_USER_HOME 
zipStorePath=wrapper/dists 
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip 
+0

你如何創建這個項目?如果通過本地機器上的gradlew目錄構建它,結果如何?您可以在OneDrive上分享簡單的示例項目嗎? –

+0

這是一個我已經在幾個月內工作過的項目,現在已經決定使用VSTS作爲構建服務器。該項目是使用LibGdx項目生成器創建的。該項目完美地在我的本地機器上構建。自從我問一個新項目開始,我確定可以在VSTS中構建,然後逐步移動代碼,測試和資產,確保它可以繼續構建。它現在工作:) – esser

回答

0

的解決方法是,你可以創建一個新的項目,並確保它可以建立在VSTS中,然後將代碼移動到新項目。