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 ?!
When you create a new project you simply need to choose the option:
...
Import project from external model
Create IDEA project structure over existing external model (Eclipse, Maven...)
...
You'll find it pretty straight forward from there.
And in your case you can close your project and simply create a new one. Choose your project's directory, which will override it, making it a Maven project.
Importing Maven dependencies may not work if you import the same path several times. This may happen automatically after importing an existing maven project. I can't figure out why this happens, so I'm inclined to think it is a bug.
For example, if my project is
the three paths may be imported as top nodes:
If such is the case, the dependencies appear to be right, but they won't be used until you remove the superfluous paths (in this case,
src/main
andsrc/test
). Once you do this, refresh and click Build > Rebuild Project. IDEA will pick up the dependencies.A symptom of this problem is that IDEA warns you of a duplicated path when you manually check a library (second screenshot in the question).
There are several ways to re-read the dependencies in case you need it. If you go to the “Maven Projects” tab, there is a “Reimport All Maven Projects” icon at the top left of the tab. If you suspect IDEA became confused you can click on File > Invalidate Caches.
I solved this issue by updating my settings.xml file with correct mirror config, seems that intellij will try to download meta-data from repository every time the maven module imported.
Go into your project structure, under project Settings, Modules, select the dependencies table. For each dependency, change the scope from 'Test' to 'Compile'.
I had the similar issue with my macbook, just did a small change in
pom.xml
and it started downloading all dependencies:Earlier dependencies were written as below for my windows machine:
I just removed the
<dependencies>
and</dependencies>
tags and it started downloading all the dependencies:I am not sure it will work for you or not.. but worked fine for me.
Thanks
I ran into the problem that some subdependencies couldn't be resolved in IntelliJ 2016.3.X. This could be fixed by changing the
Maven home directory
in Settings > Build, Execution, Deployment > Build Tools > Maven fromBundled (Maven 3)
to/usr/share/maven
.After that all subdependencies got resolved as in previous IntelliJ versions.