0

I am trying to use this tool from Google: https://github.com/pcj/google-options

In the example given by Google, they use:

import com.google.devtools.common.options.OptionsParser;

to allow their example code to use the command line parser.

When I do this, Eclipse says the referenced files don't exist.

I have tried putting the source file from google-options in a package in my project; no luck. I tried running Google's example, and it won't even compile. It can't find all of the classes in its own src folder.

Based on my research, I think there's either an issue with a .jar file needing to be in the build path, something to do with Apache Ant, or an issue with GitHub I don't understand.

I'm very new to GitHub; this is the first time I've tried to do anything like this.

Jameson
  • 6,400
  • 6
  • 32
  • 53
silvertiger
  • 55
  • 2
  • 12
  • The README shows ways to use it with Maven or Gradle. Are you using Ant? If so, can you use Maven or Gradle and follow their guide? https://github.com/pcj/google-options/blob/master/README.md – Jameson Mar 10 '17 at 05:48
  • I guess the below link might help you http://stackoverflow.com/questions/6760115/importing-a-github-project-into-eclipse – Abhishek Vk Mar 10 '17 at 05:50

3 Answers3

0

You should first import this project from GitHub to your local machine. import statement in your class means that classes from other packages should be imported to this class you're working on. Import not from the remote source, but from local.

Vitali Plagov
  • 722
  • 1
  • 12
  • 31
0

I figured it out. It needs the guava.jar file found here added to the buildpath. After that, it has a couple weird dependency issues with javax, but I just removed those (it was Nullable and Immutable, if anyone's interested).

silvertiger
  • 55
  • 2
  • 12
0

First you must clone the project and compile it, to do that put the following commands:

  1. Open your terminal and go to the workspace folder:cd {workspace}
  2. Clone the project: git clone https://github.com/pcj/google-options.git
  3. Compile the project: mvn clean install
    • Check the result, this should print: BUILD SUCCESS
    • In that step, maven will download all dependencies that the project needs.
  4. To import the project: Launch eclipse, click on File /Import... choose Existing Maven project, browse your workspace where the projetc was cloned.
  5. Create a class that extends OptionsBase and defines your @Option(s). For more information about how to use, see https://github.com/pcj/google-options#usage
JUAN CALVOPINA M
  • 3,695
  • 2
  • 21
  • 37