Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add dependencies to pom.xml in IntelliJ 14

I have a few dependencies in Project Structure/Libraries in IntelliJ 14. How can I add them to my maven pom.xml? There is one single tutorial on IntelliJ's website that does not work for me. I don't want to manage them manually.

like image 963
Dyin Avatar asked Sep 29 '22 06:09

Dyin


1 Answers

The proper way to do this would be to install the dependency artifacts (most likely jars) into your local maven repo, like this.

How to install artifacts to your local maven repo

And then add the dependencies into your pom.xml

<dependencies>
    <dependency>
        <groupId>com.something</groupId>
        <artifactId>artifact</artifactId>
        <version>1.2.3</version>
    </dependency>
</dependencies>

Yes, this does require going through each artifact manually, one at a time, but it's a one time setup process.

That is the "proper" way. After that, you can do away with library dependencies in your project structure (they will be picked up correctly via maven).

There is the alternative possibility to "hack" in your project libraries path as a sort of "embedded" maven repo in your project, but that's a little bit hacky and I wouldn't advise that.

like image 58
vikingsteve Avatar answered Oct 03 '22 03:10

vikingsteve