1

When I right-click a missing import, I have an option of "Find Jar on Web", but the Jars in the list are outdated. For example, the newest ant jar on the list is ant-1.7.1.jar, but I know that ant-1.10.1.jar is available from Maven Central.

How can I add more "sources" to the search of IntelliJ?

enter image description here

1 Answer 1

2

This happens because the repositories is outdated in your IntelliJ, so, you can update with these steps, go to:

Preferences > Build, Execution, Deployment > Maven > Repositories

Choose the Remote repository entry and click on Update button, this action takes some minutes, after of that, do the same with your Local repository, IntelliJ will be able to retrieve the last versions of your dependencies.

enter image description here

UPDATE

To view the remote repositories in IntelliJ, you can add in your settings.xml file (check this) or directly in your pom.xml file of your project.

This is the structure for your settings.xml file:

<project> <repositories> <repository> <id>maven-central</id> <url>http://repo.maven.apache.org/maven2</url> </repository> </repositories> </project> 

And this is the structure for your pom.xml file:

<dependencies> ... </dependencies> <repositories> <repository> <id>codehausSnapshots</id> <name>Codehaus Snapshots</name> <releases> <enabled>false</enabled> <updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> <checksumPolicy>fail</checksumPolicy> </snapshots> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> </repository> </repositories> 

After of add this configuration, IntelliJ will be able to detect the new repository.

Notice: The updated specified in your pom.xml file (or inherited from parent project's pom and settings.xml)

Sign up to request clarification or add additional context in comments.

2 Comments

It says No remote repositories for that project, but in another project I see the URL that you posted. How can I add a Maven repository?
In the current version of IntelliJ these settings are found at File > Settings... > Build, Execution, Deployment > Remote Jar Repositories.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.