使用VSTS构建libgdx项目

时间:2017-10-12 08:17:44

标签: android libgdx azure-devops

我正在尝试为我的LibGdx项目设置VSTS构建。在我的VSTS构建定义中,我使用标准的Gradle构建步骤,其中构建失败。

来自VSTS的堆栈跟踪如下所示:

public override object ConvertFromString(TypeConverterOptions options, string text)
{
    if (string.IsNullOrEmpty(text)) return null;

    DateTimeFormatInfo info = new DateTimeFormatInfo() { FullDateTimePattern = DateStringFormat };

    return Convert.ToDateTime(text, info);
}

我怀疑构建是否正在尝试执行“构建”。命令在错误的目录中。当前目录不应该是:D:\ a \ 1 \ s \ ProjName?

我的gradle包装文件在这里:

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

和我的gradle-wrapper.properties文件:

@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

1 个答案:

答案 0 :(得分:0)

解决方法是您可以创建一个新项目并确保它可以在VSTS中构建,然后将代码移动到新项目。