Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Best practices for adding 3rd-party libs to my project

$
0
0

Hi, I'm evaluating IntelliJ IDEA v11.1.4 on my Mac.  I'm trying to add a simple 3rd-party library to my new project, and I'm looking for a best practice suggestion on how to do this.  In my limited experience with Java, I typically end up needing to add a dozen or so libraries to my project, and most all of them come with 3 constituent pieces:  somelibrary-docs.zip, somelibrary-src.zip, and somelibrary.jar.  (the library I'm currently working with, sqlite4java, just happens to have this jnilib business but I'm pretty sure this is not typical so we can ignore this for the sake of simplicty)

 

To mimic the best practices I've seen used in the past on a certain other IDE, I've set my project up as follows in IntelliJ

 

MyProject

  .idea

  doc

    sqlite4java-docs.zip

  lib

    libsqlite4java-osx.jnilib <-- let's ignore this for now per above comment

    sqlite4java.jar

  src

    MyProject

    sqlite4java-src.zip

  tests

  MyProject.iml


 

Now, it seems like there are two ways to make IntelliJ cognizant of a 3rd-party library, its javadocs, and its source.  The first way is by going to Project Settings : Modules : Dependencies, and doing some voodoo magic here, such as designating a directory (lib) as a jar directory - but then, how do I attach javadocs and src to each jar?  A second way apparently is to add the library using Project Settings : Libraries to add the library's jar, and then somehow magically attaching javadocs and source code through a settings panel that is not evident to me. 

 

Since I'm OCD, even with dozens of libraries, I like explicitly to attach its source and javadocs, so using the first way and adding libraries one-at-a-time works best for me.  Others tend to prefer to dump all the JARs into a directory, and to hell with documentation and source, so designating a directory as a JAR directory and dumping in 3rd party library JARs with impunity is preferred; this would be the second way, as I understand it.

 

Can someone kindly help articulate the voodoo magic phase of this into actual steps that I can do in this IDE?  Thanks!


Viewing all articles
Browse latest Browse all 5661

Trending Articles