3

I want to add the "html2image" library to my project so I can use it in my code. But I don't get it, how the pom.xml does have to look like.

This is how my pom.xml looks like for now:

pom image

I added the lines 33 to 37 and 48 to 52.

I know I need this parameters, but I have no idea what to write between the tags. You can see my 3 jar files on the left hand side. There is a lib folder created with these three files.

Please help!

Lino556
  • 133
  • 1
  • 9
  • Please check your maven dependencies jst below the jre library.. Maven doesn't copy jar to lib . it placed the jar to .m2 folder and pass a reference to your project .only copy all jars when it is going to be packaged as `war` or `jar` for deployment – Vikrant Kashyap Feb 29 '16 at 16:15

2 Answers2

1

You don't need to have the jar in your project. You only need a separate lib-folder if the lib you need is not in the maven repository!

Go to http://mvnrepository.com, search for the depencency, and copy-paste the snippet in your pom in the dependencies section (which must be below project in the xml tree), something like this

<project>
  <dependencies>
   <dependency>
     <groupId>com.github.xuwei-k</groupId>
     <artifactId>html2image</artifactId>
     <version>0.1.0</version>
   </dependency>
  </dependencies>
</project>

The update the project (if its not updating automatically, press alt+F5). Done!

Raphael Roth
  • 26,751
  • 15
  • 88
  • 145
0

Usually when I want to add some library to my maven project, I google [library name] maven, and choose the result from http://mvnrepository.com/. There you'll find the groupId, artifactId and version number you're looking for.

Here's a relevant example: http://mvnrepository.com/artifact/com.github.xuwei-k/html2image/0.1.0

cognalog
  • 440
  • 5
  • 8
  • It's the first time I'm working with maven projects/libraries. So thank you for the hint. Very helpful! – Lino556 Feb 29 '16 at 16:24