I have a small question about IntelliJ IDEA 11. I just imported a project from subversion - its a maven project. But I have a problem in maven library dependencies so that I can't include all maven dependencies automatically - IDEA shows dependency errors only when I open that class/ Thats what I get here:
So I want all dependencies to be added automatically - is that possible or do I have to go through all class files to identify and add maven dependencies?!
UPDATE: After doing some modifications I found how to resolve my problem in some way. Thats what I did:
but I think logically it will not include and check new dependencies ahead?!... Is there any settings area for this in intelliJ - auto export dependencies to classpath ?!
Deleting the .idea folder from the project directory, and then re-importing the project as a Maven project is what worked for me.
Try to Re-Import the project from the Maven Projects panel in IntelliJ IDEA. It should download and configure all the dependencies defined in your
pom.xml
automatically.If download doesn't work from IDEA for some reason, try
mvn install
from the command line and see if the dependencies can be fetched.Of course all the required dependencies and any custom repositories must be defined directly in the
pom.xml
file.IntelliJ should download and add all your dependencies to the project's classpath automatically as long as your POM is compliant and all the dependencies are available.
When importing Maven projects into IntelliJ an information box usually comes up asking you if you want to configure Auto-Import for Maven projects. That means that if you make any changes to your POM those changes will be loaded automatically.
You can enable such feature going to File > Settings > Maven > Importing, there is a checkbox that says "Import Maven projects automatically".
If that doesn't help, then I would suggest to make a full clean-up and start again:
*.iml
files and all.idea
folders (there should be one per module)mvn clean install
from the command lineIntelliJ 2016 Update:
The Import Maven Projects automatically setting has been moved to Build, Execution, Deployment > Build Tools > Maven > Importing in your IntelliJ preferences.
If in the lower right corner it says "2 processes running..." or similar, you may just need to wait for that to finish, since it may take time to download all the jars.
In maven the dependencies got included for me when I removed the dependencyManagement xml section and just had dependencies directly under project section
I had a similar issue, in my case I am using a custom
settings.xml
which was not picked from IntelliJ.Solution:
File > Settings > Build, Execution, Deployment > Maven: User settings file
(chose here my custom settings.xml).