Unable to import Maven project into IntelliJ IDEA

前端 未结 12 930
春和景丽
春和景丽 2020-12-01 07:41

I\'m having problems importing any Maven projects into IntelliJ IDEA. I create an empty Maven project like this:

$ mvn archetype:generate -DgroupId=com.mycom         


        
相关标签:
12条回答
  • 2020-12-01 08:16

    I had this same problem. I don't know what caused it to start happening, I only know how I fixed it.

    I found from looking at lsof -i -P that the maven remote server was attempting to run on IPv6, and apparently IntelliJ could not speak to it on IPv6. I'm not sure if it used to run on IPv4 and something caused it to start using IPv6, or if it always used IPv6 and a mac update somehow made it stop working.

    Anyway, the solution I used was to edit /Applications/IntelliJ IDEA 11.app/Contents/Info.plist and add the java.net.preferIPv4Stack parameter to the java process:

    <key>java</key>
    <dict>
      <key>Properties</key>
      <dict>
        <key>java.net.preferIPv4Stack</key>
        <string>true</string>
      </dict>
    </dict>
    

    I really wish I could give more information about why this happened to begin with.

    0 讨论(0)
  • 2020-12-01 08:17

    It's a common problem related to networking and address resolution. In some cases localhost may not resolve and it's required to have

    127.0.0.1 localhost
    

    in /etc/hosts file. Also make sure there are no other IP addresses mapped to localhost.

    See my comment in the related YouTrack issue for more details.

    0 讨论(0)
  • 2020-12-01 08:18

    I had similiar issue on

    MAC OS X

    what i did:

    • deactivated FIREWALL
    • set proxy in intellij (like explained in this thread)
    • set the ipstack-flag

    nothing solved the problem...

    what helped

    • starting intellij with Java 1.6 and NOT java 1.8 (defined in /Applications/IntelliJ\ IDEA\ 14.app/Contents/Info.plist )

    strange

    0 讨论(0)
  • 2020-12-01 08:20

    I had the same issue on Linux Mint. Tried everything but nothing helped. Turned out my etc/hosts file was corrupted and restoring it worked. Another solution is here : https://www.digitalocean.com/community/questions/how-to-restore-etc-hosts-on-ubuntu-14-04

    0 讨论(0)
  • 2020-12-01 08:27

    Find out what process on your machine is holding the port. On Ubuntu Linux, I executed the following commands:

    ps -ef | grep idea

    Noticed that there is a Java process running the class org.jetbrains.idea.maven.server.RemoteMavenServer

    I noted the pid of 2772 and executed

    netstat -anp | grep 2772

    I noted that pid 2772 was listening on port 6942

    I telneted to that port:

    telnet localhost 6942
    Trying 127.0.0.1...  
    Connected to localhost.
    Escape character is '^]'.
    /home/noahlz/.IdeaIC11/config/ home/noahlz/.IdeaIC11/system
    

    So the Maven component used by IntelliJ runs as a distinct server process, which IntelliJ speaks to over a socket. You'll need to determine why IntelliJ can't reach that server port on your machine, i.e. what other process is holding onto that port and/or not sending a response back to IntelliJ

    Note that the port number on your machine might be different.

    0 讨论(0)
  • 2020-12-01 08:27

    In my case below line was set in ~/.profile

    export _JAVA_OPTIONS="-Djava.net.preferIPv6Addresses=true

    i just removed the line and rebooted. works fine after

    0 讨论(0)
提交回复
热议问题