简体   繁体   中英

After building the project from pom.xml using Maven, how do I use its resources

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.

在此处输入图片说明

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM