|
Post by utv on Feb 28, 2015 18:37:46 GMT -8
Hello all,
GamerServerRunner is a utility program for running a match in command line. However I have failed running it and it gives me an error like this.
It seems the project is not built properly so it can't find the google library. I did build a project using ./gradlew build
Is this problem caused by build process or something else? Thank you.
|
|
|
Post by Andrew Rose on Mar 1, 2015 1:48:26 GMT -8
This is a classpath problem. I've never used gradle before and my codebase has a substantially modified classpath now (because I've added various jars, removed others, etc.) so I can't give you step-by-step. However, you basically need to get all the jars under src\external (and sub-directories) into your path. In this particular instance, you're missing Guava src\external\Guava\guava-14.0.1.jar from the classpath.
|
|
utv
New Member
Posts: 18
|
Post by utv on Mar 1, 2015 3:09:06 GMT -8
Thanks Andrew! I got some idea from your answer, I never use gradle either. By the way, I have looked at gradle doc and found that we can add java program as a task on gradle and it works without Guava jar!
|
|
utv
New Member
Posts: 18
|
Post by utv on Mar 1, 2015 19:35:12 GMT -8
I still stuck with this, I have a problem passing arguments to GameServerRunner task defined by gradual. Anyone know how to make GameServerRunner.java runnable by gradle?
|
|
utv
New Member
Posts: 18
|
Post by utv on Mar 2, 2015 1:14:53 GMT -8
Hi guys,
I have figured out the solution. 1. Define a task in build.gradle
task gameServerRunner(type: JavaExec) { main = 'org.ggp.base.apps.utilities.GameServerRunner' classpath = sourceSets.main.runtimeClasspath doFirst { args = myargs.split().toList() } } 2. Define gameServerRunner.sh
./gradlew gameServerRunner -Pmyargs="$*" 3. Call it
./gameServerRunner.sh arg1 arg2 arg3 ...
|
|
|
Post by alandau on Mar 3, 2015 17:44:32 GMT -8
If you use Eclipse to work with the code, you should also be able to run programs from within Eclipse. Other IDEs should also work if configured correctly (and Gradle may be able to generate configuration files for them that include the necessary dependencies).
Thanks for posting instructions for adding a new class runner that accepts command line arguments.
|
|
utv
New Member
Posts: 18
|
Post by utv on Mar 4, 2015 5:29:43 GMT -8
Thank you, Alan. I need Gradle because I want to run GameServerRunner from command line.
|
|
|
Post by alandau on Mar 16, 2015 17:17:50 GMT -8
I've added this to the repository, along with a PROGRAMS readme file that explains how to run the different programs available: github.com/ggp-org/ggp-base/pull/67There are still more programs with a main() function to be made runnable via Gradle. Also, the two that require scripts (for passing in arguments) don't have Windows-friendly scripts yet.
|
|