1

It's been tedious. This is the API I am trying to use. Its resources were set up in a pom.xml which I built using Maven. On built up, it gave me the project socrata-publisher that has

  • src/main/java the source folder with packages com.socrata.api com.socrata.data, com.socrata.util where each contains only .java files
  • JRE System Library and Maven Dependency hierarchies where each contains a number of jar files

Problem is com.socrata.api and the 2 other contains classes which I want to deploy in a project outside socrata-publisher. I tried using import com.socrata.api but it didn't work. Moreover, since its a Java project and not android it doesn't have the is Library option in preferences which could rather give me the solution. Both socrata-publisher and tutorial (where i want to use the resources and which is the android application) lie in the same directory eclipseApps in My Documents.

Here's a little visual queue. Help will be greatly appreciated.

enter image description here

jmishra
  • 2,086
  • 2
  • 24
  • 38
  • I'm not sure to understand what you want. Is your tutorial also a Maven project? If yes, then did you try adding the dependency towards socrata-publisher? If not, then you can simply add the socrata-publisher project as dependency in the Java-build path of your tutorial project. – Guillaume Polet Mar 18 '12 at 10:08
  • I really appreciate your feedback. But no, tutorial is a simple android project. I tried adding the resources to its Java Build Path and its strange because only `JRE System Library` is visible along with other projects but not `socrata-publisher` (which happens to be its parent). – jmishra Mar 18 '12 at 10:13
  • You'll need to add both the output of the socrata project, *and* all of its Maven dependencies, found in your home directory under `$HOME/.m2/repository`. – Dave Newton Mar 18 '12 at 10:31
  • Is there a procedural solution to that? I am sorry I don't exactly know how to do it. I solution in eclipse would be greatly helpful – jmishra Mar 18 '12 at 11:03

2 Answers2

1

You will need to first of all get the output of the socrata project and all its dependencies.

In command line, going to the project folder of the socrata project, where the pom.xml file is, run MVN INSTALL. You shall see a jar file called socrata-api.jar in $HOME/.m2/repository. If you are using windows and installed MAVEN by default, $HOME should be your user profile folder. Once you see the jar file, add it to your tutorial build path.

sarahTheButterFly
  • 1,894
  • 3
  • 22
  • 36
  • Thanks a lot. I couldn't use the Command prompt but I manually added it in my library from $HOME\.m2\repository folder. Now it is successfully listing `com.socrata.api` in the package autocomplete. – jmishra Mar 18 '12 at 19:10
0

I think what you actually want to do is just set up the "socrata-publisher" as a project dependency for your "tutorial" project. That will allow you to reference the built Socrata libraries from the code in your project.

Right click on the project and select "Properties". From within that dialog select "Java Build Path" on the left, then the "Projects" section, and click the "Add" button to add the "socrata-publisher" project.

I think that'll work better than creating a separate jar file that you then include, and then you can also keep the socrata-publisher code up to date using Git.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
chrismetcalf
  • 1,556
  • 1
  • 8
  • 7