views:

80

answers:

3

I've got an Ant task (using the maven task) set up to automatically download all my Java apps dependencies and consolidate them into a lib directory, but I cant see a way to tell IntelliJ to basically treat everything in that dir as an external lib - I have to manually add them all to my project.

This rather defeats the object of automatically downloading my external dependencies...

SO is there any way to say to Intellij 'this dir contains my external dependencies, so automatically parse these (for Autocomplete etc), and add them to the classpath when I launch my app from the IDE'?

A: 

In version 8 you can create a library (from the File->Project Structure) and there is a button called attach jar directories that does exactly what you are looking for. I'm pretty sure it was there in 7 as well (everything was under File Settings), but it may not be there in 6.

Yishai
A: 

IntelliJ 8 has Maven integration (http://www.jetbrains.com/idea/features/ant_maven.html#Maven_Integration).

For older versions you'll have to look for a plug-in. I know they are out there but not sure of their exact functionality.

I've had a similar problem in the past where dependencies where specified using Ivy. I solved that by writing an Ant task given the dependencies (obtained from the Ivy Ant tasks) updated the appropriate iml file.

Nick Holt
A: 

You mean the

Maven IDEA plugin

can't do what you want?

As an alternative you might use this "trick"

Downloading JARs from Maven into IntelliJ Projects

jitter