No next button when importing Maven projects in IntelliJ - maven

I am trying to follow a tutorial on spring boot, first step is to import a maven project in intelliJ, generated by spring initializer, but when I try to do so, I have no next button in the import window, only "finish". And when I click on finish, it does not seem to detect packages. Any idea ?

Import from Maven dialog was replaced with single open action and now takes all the defaults without showing any additional dialogs with many various settings: IDEA-223880.

You may check with these guidelines.
Just type mvn install in the terminal.
or
Settings --> Build,Execution,Deployment --> Maven --> importing
Check the import Maven projects automatically
which will enable imports automatically.

Indeed all dependencies were resolved with maven build :)
Thanks guys !

Just to keep the question complete: In my case IntelliJ was unstable with JDK 12 and I had to use JDK 15. Another thing you might check is whether pom.xml is in the directory (in the past I have accidentally removed the file - type "maven" was displayed but after selecting "Maven" type there was only "Finish" and no "Next").

Related

Minor Annoyance: edu.emory.mathcs.backport.java.util

I know this is trivial, but I bet I am not the only developer being annoyed by this issue:
I have a maven project building a Spring Hibernate frameowrk for a webapp.
I am building using Eclipse.
I use Eclipse shortcuts to import dependencies and often do so almost subconsciously.
Somewhere in my project dependencies I have a jar that includes the following package.
edu.emory.mathcs.backport.java.util
I often accidentally import this package instead of java.util and get compile or runtime errors.
QUESTION: How can I find out which dependency includes this package so I can (hopefully) exclude it using the Maven enforcer plugin.
This does not directly answer your question but may help you prevent the accidental import in the first place:
In Eclipse you can add a type filter in Preferences → Java → Appearance → Type Filters.
From the description there:
All types whose fully qualified name matches the selected filter strings will not be shown in the 'Open Type' dialog. They will also be ignored in content assist or quick fix proposals and when organizing imports. For example 'java.awt.*' will hide all types from the awt packages.
You can run mvn dependency:tree from the command line. It will show a tree of your dependencies and their transitive dependencies.
Within Eclipse you can open your pom.xml using the Maven POM Editor (default editor for POM files) and click on Dependency Hierarchy.
Within this view you can use a filter or select the dependency on the right side and the dependency tree for this dependency will be shown on the left side.
I recently encountered this issue with a Maven project in IntelliJ IDEA.
You can view transitive dependencies using the Maven command mvn dependency:tree to figure out where this package is creeping in.
However, it's worthwhile to mention that this problem can occur for Gradle or Maven projects. If you are using IntelliJ, then another workaround that will work for all of your projects - regardless of build tool - is to exclude the package altogether from the IDE's editor settings.
The steps to exclude the edu.emory.mathcs.backport.java.util package when using auto-import for all of your projects opened in IntelliJ are as follows (this is valid for IntelliJ IDEA 2022.2):
Ctrl + Alt + S (or click on File, then Settings)
Editor > General > Auto Import
Under the exclusion section, add the following exclusion with an IDE scope: edu.emory.mathcs.backport.java.util.*
Reference Screenshot

Can not import maven project to IDEA 14

I do $ mvn archetype:generate -DgroupId=demo -DartifactId=demo to create a maven project
then I want import the project to IDEA 14
then I choose Import project from external model and maven to next.
then there are some option we need to do , I just click next.
then it tells me to Select Maven projects to import
but there is nothing to show.
please tell me how to create a maven project and how to import it to IDEA 14 .
I always just Open project by selecting its pom.xml and it works well every time. Try this instead of Import Project.
I faced the same problem today. Tried many times. Finally, I got the solution that just to kill all the IntelliJ processes, restart it. It works. Seems some memory got corrupted, but please at least show some error message.

Using Intellij + Maven to import libraries: Cannot resolve symbol

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?
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?

Adding maven support to existing IntelliJ module is not available

I just started an IntelliJ plugin project, and after going a few steps, I realized that I am not managing dependencies with maven. Naturally I head over to the module in the project explorer, and right click -> Add Framework Support. But Maven is not listed! In fact, the only thing listed is Groovy. What could cause this, and how do I get maven back?
The maven plugin is enabled.
Here is a brief answer how to get going with Gradle, but most questions remain unanswered.
How to manage development life cycle of IntelliJ plugins with Maven
For a comprehensive read this post : http://labs.bsb.com/2013/11/how-to-manage-development-life-cycle-of-intellij-plugins-with-maven-2/
The post also includes a link to the source code on github.
Making your plugin project use maven in IntelliJ
This is probably not what you are struggling with, but I include it just in case. Supposing you have already started a new plugin project you have two options:
Right-click on the project name in the project explorer and choose New > Module
Create a pom.xml in the project root, then right-click on it and choose Add as Maven Project
hth
First, make sure you have enabled maven plugin in
File -> Settings -> Plugins and add search the maven plugin and activate
Restart the IntelliJ.
Go and check the tool window to make it visible
go to View -> Tool Windows > Maven Projects to open it.
The above options might take some time to execute but there is a quick fix to this if you already have a pom.xml file present in the project.
Right click on the pom.xml file and you will see an option
Add as Maven Project
As far as I understood, you have to mark your folder with pom.xml as Maven module.
In order for the project to become Maven:
Go to - File -> Project Structure (or Ctrl + Shift + Alt + S)-> Modules.
In the middle, you must remove the existing module.
Then in the same place of window click on the plus -> Import module -> Select the
required folder with pom.xml -> Import module from external module -> Maven -> Next ->
Finish
You may need to restart your IntelijIdea. Better just in case to restart it.
After restarting it, it should be appear a pop-up window in the lower right corner - Import maven module -> Click on it.
After that, the folder for module and pom.xml should be displayed as Maven.
P. S. Also check before these steps, that you have Maven support for your IntelijIdea.
Solved it being root as intelliJ launcher... not the best solution but seems a workaround.
So the best solution I found yet instead of digging into filesystem to see where there is a permissions problem was to change the owner to my user
sudo chown -R myUsername:myUsergroup /opt/becauseIInstalledItHere/idea-IC-version
To get the option in the right hand of intellij you have to follow two step given below -
Right click on Pom.xml
Click on "add as Maven Project"

Create a Maven project in Intellij IDEA 12 but alway in the "Loading archetype list "page

I created a Maven project in IntelliJ IDEA 12, finished the project name and pressed “next”,and now it shows GroupId,ArtifactId and Version. But Maven archetypes don't appear. It says
Loading archetype list....
I can press the “finish” but the project that created is not a web project.
Has anyone ever faced this situation?
You can try to delete the files under {User_Home}/.IntelliJIdea{Version}/system/Maven/Indices
and then restart your idea, this should work.
Don't know if the question is still actual, but maybe you need to update maven's repositories index at first?
Settings->Maven->Repositories - select maven's Central repo (if it's there; otherwise you should add it (http://repo.maven.apache.org/maven2/)) and press Update button. This will take some time (it's about 270MB to download and parse for now). After that you'll have all the maven's Central index available locally together with an archetypes list.
If there's still a problem with Loading after things done, you may want to specify Maven->Importing: "VM options for importer" to -Xmx1024m (default is -Xmx512m and it's not enough).

Resources