Using Intellij + Maven to import libraries: Cannot

2019-02-18 03:52发布

问题:

I have imported a library (JBox2D) using Maven in IntelliJ 13, for use in an android project. Maven didn't give me any error messages, so I assume the library was imported correctly.

However, as soon as I try use a class from the library, I get "Cannot resolve symbol". IntelliJ doesn't offer the option of adding an import statement, as it normally does.

How should I proceed?

回答1:

Open the maven window and hit the reimport button (it's usually the first one on the toolbar). This will force IntelliJ to reimport your project based on changes in your pom.

Also, check the maven settings within IntelliJ and confirm that you're configured to use the same maven in IntelliJ as you're using on the command line.

If this doesn't work, then try to explain in more detail what you mean by your having imported a library with maven?