Reputation: 637
I'm not familiar with using java package. Now I'm given a set of java files that import plenty of stuff. But there's no pom.xml file provided.
First I tried to directly compile the files, but was told com.amazonaws is not found
. So I think I may need to download all the dependencies. But there are simply too many import statements so it seems not very practical to download them one by one manually.
Then I found that I may use maven. But after I tried creating this pom.xml
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.341</version>
</dependency>
</dependencies>
and use mvn package
. I got an error telling me building failed. I thought that might be because I didn't specify all the dependencies. Is there a way to automatically pull dependencies based on import
statements in the java files?
Upvotes: 2
Views: 1908
Reputation: 128
Using MVN is best approach to add dependencies to you project. You need to write some more stuff in your pom.xml . You can go through this example https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html to create a maven project step by step
Upvotes: 0
Reputation: 121799
Maven is the right way to go. And you've made a good start.
Although Maven is very good about pulling "implicit dependencies", it can't "guess" everything. It sounds like you're going to have to add just a bit more to your pom.xml
SUGGESTIONS:
Read this:
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-project-maven.html
Post the specific errors you're getting with your current pom.xml. Be sure to copy/paste the exact errors, along with updating the exact contents of the pom.xml that you used in that iteration.
Upvotes: 1