Add all jars in a repository as dependencies in IntelliJ - intellij-idea

I have a savant repository in my project and I want to add all of the jars contained within the repo to IntelliJ's depenedcies list. I can add the jars one at a time, but I want to be able to add them all at once.
Is there a way to add all the jars found within all the directories/subdirectories?
Details: IntelliJ 12
Update: I can not change the repository structure, it is auto populated when ant builds.

Adding jars from a directory is supported, but not recursively, please vote for this feature request.

Yes, you can add all jars in a folder.
You have to create a library and select option: "Attach file or directories" and the select a directory.
This way even a future changes to the directory will be visible.

Related

How to see dependency tree for JARS in IntelliJ using SBT

I am using intelliJ IDEA 2017.2.5 for spark-scala using SBT.
i have many dependencies jars but i wanted to know that which jar is getting downloaded or coming along BECOZ of which jar.
For example i have specified Jar_1 in my build.sbt file. Now when the project is built using SBT, along with Jar_1, multiple jars like jar_1.1, jar_1.2, jar_1.3 also gets downloaded. Now when i click on jar_1.3 or jar_1.2 i don't see the directory or any tree like structure which shows that its a child of Jar_1.
This feature is present in Eclipse. Attaching the image which shows this kind of Hierarchy.
As you can see the jars and also it shows that because of which jars it was downloaded. I need to know that whether such thing is available in IntelliJ if yes how to use it
It's not possible in IntelliJ IDEA for the SBT based projects at the moment, please vote for this feature request.

How to add dependent jars to deploying plug-in

I would to like to add the dependent jars to the update site plugin project in Eclipse.
I followed
http://wiki.eclipse.org/FAQ_How_do_I_create_an_update_site_%28site.xml%29%3F
but, it does not address the above issue. How to deal with the dependent jars with deploying plugin? Anybody please help with ideas.
Thanks
I'm going to assume you are wanting to add additional Jar files to your plugin. You can do this by simply putting the Jar files into the top level directory of your plugin, and in the Classpath portion of the Runtime tab in the Plugin Manifest Editor you can specify the Jar file. This will automatically add it to the build path as well.
Some people prefer to make an extra plugin that contains nothing but external Jar files; you add the Jar files to this extra plugin the same way and then just use the Dependencies tab in the Plugin Manifest Editor to make your original plugin dependent on the Jar plugin.

Adding Jar files to IntellijIdea classpath

I have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows:
repository/commons-logging/commons-logging-1.0.4.jar
repository/commons-lang/commons-lang-2.1.jar
etc.
I want to add them just by pointing to the repository directory, but couldn't find any ways to add them.
But when I am using classes or API from that jars, the editor can't resolve the classes.
I have tried from Project Structure but can't configure it.
Go to File-> Project Structure-> Libraries and click green "+" to add the directory folder that has the JARs to CLASSPATH. Everything in that folder will be added to CLASSPATH.
Update:
It's 2018. It's a better idea to use a dependency manager like Maven and externalize your dependencies. Don't add JAR files to your project in a /lib folder anymore.
If, as I just encountered, you happen to have a jar file listed in the Project Structures->Libraries that is not in your classpath, the correct answer can be found by following the link given by #CrazyCoder above: Look here http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html
This says that to add the jar file as a module dependency within the Project Structure dialog:
Open Project Structure
Select Modules, then click on the module for which you want the dependency
Choose the Dependencies tab
Click the '+' at the bottom of the page and choose the appropriate way to connect to the library file. If the jar file is already listed in Libraries, then select 'Library'.
On the Mac version I was getting the error when trying to run JSON-Clojure.json.clj, which is the script to export a database table to JSON. To get it to work I had to download the latest Clojure JAR from http://clojure.org/ and then right-click on PHPStorm app in the Finder and "Show Package Contents". Then go to Contents in there. Then open the lib folder, and see a bunch of .jar files. Copy the clojure-1.8.0.jar file from the unzipped archive I downloaded from clojure.org into the aforementioned lib folder inside the PHPStorm.app/Contents/lib. Restart the app. Now it freaking works.
EDIT: You also have to put the JSR-223 script engine into PHPStorm.app/Contents/lib. It can be built from https://github.com/ato/clojure-jsr223 or downloaded from https://www.dropbox.com/s/jg7s0c41t5ceu7o/clojure-jsr223-1.5.1.jar?dl=0 .

How to generate a jar from a java module in IntelliJ with the dependencies placed in a separate directory?

I have a module for which I want a jar to be created. So, here is what I do:
Adding a jar artifact, using the "From module with dependencies ..." option
In "Jar files from libraries" I select "copy to the output directory and link via manifest"
Leave all the defaults.
After that I can build the jar and all the dependencies would be placed near it in the same directory. So far so good.
Now I wish all the dependencies to be placed in a separate directory near the final jar. So, I repeat the same steps, but this time I create a new directory under the node in the artifact Output Layout tab (using the "Create Directory" button). Next I drag all the dependencies onto the new folder and apply the changes.
On the surface, everything is cool - the dependencies are indeed placed in the dedicated directory, but the MANIFEST.MF file is never updated! It should reference the dependencies via the new directory. As of now, the produced jar cannot be run - its dependencies are not visible.
This is unlike Eclipse, which does make sure the manifest file is correct when exporting a project as jar.
How can I workaround this problem, given that:
I want all the dependencies in a dedicated folder.
I want to use IntelliJ IDEA
I do not want to edit the manifest file manually.
I am using the latest download of the IntelliJ IDEA for windows - 11.1.2, build 117.418
Thanks.
At the moment you have to update the classpath manually in the artifact configuration dialog so that it includes the subdirectory:
I've created an issue for this limitation, please star/vote.

IntelliJ IDEA: "Indexed Maven Repositories" list - how to add remote maven repository in this list?

I'm having trouble understanding how to get repositories in the "Indexed Maven Repositories" list of the IntelliJ IDEA.
In one my project I have two repos in this list: one local and one (main) remote (see attached screenshot below). And in other project (created using AppFuse template) I have only one (local) repo in list.
I'm tried to add the repos in pom.xml file and in settings.xml file, but the repos did not appear in this "magic" list.
And this means:
I can't see artifactId and versions of artifacts in dropdownlist (Ctrl+SPACE)
IDEA can't find the necessary artifacts (or his versions). It is looking only in my local repo
Version of IntelliJ IDEA: 11.0
Version of Maven: 2.2.1
This list is updated automatically from the repositories specified in your pom files (or inherited from parent project's pom and settings.xml).
If you open a project that has some additional repositories specified, you'll see them in this list and will be able to update the indices.
You can manage these settings by editing your settings.xml file of the project
Open the Project file list (Ctrl-1)
Find your main parent pom.xml file
Right click on it Choose Maven -> Open 'settings.xml'
As you can see it is a local copy of settings.xml file for your project.
There is you can add/remove active repositories of the project.
Look at the settings->repositories manual for details.
I had a related issue where I changed the repository in my settings.xml but the Indexed Maven Repositories list was still pointing to the old one. In order to get the maven build to look at the new one I had to run mvn idea:idea on the project