当我在macOS上运行IntelliJ IDEA 2021.1.2(终极版或社区版)时,我观察到所有网络接口(eth0、lo、…)上都有3个随机端口打开。一个随机端口由创意进程打开,另外两个端口由IntelliJ IDEA启动的不同java进程打开。
我已经删除了我明确安装的唯一插件SonarLint。
在端口63342上运行的调试器绑定到localhost这可以在首选项菜单中配置。
以下是lsof-i|grep LISTEN
输出的相关部分:
idea 3328 orto 187u IPv4 0x3c332685aa6872fd 0t0 TCP localhost:6942 (LISTEN)
idea 3328 orto 686u IPv4 0x3c332685aa623815 0t0 TCP localhost:63342 (LISTEN)
idea 3328 orto 752u IPv4 0x3c332685aa676de5 0t0 TCP *:53212 (LISTEN)
java 3341 orto 33u IPv6 0x3c332685aa5f899d 0t0 TCP *:61070 (LISTEN)
java 3341 orto 77u IPv6 0x3c332685b9885edd 0t0 TCP *:53210 (LISTEN)
正如所问,这是ps-ef|grep 3341
的相关部分(它是一个RemoteMavenServer):
/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/bin/java -d64 -Djava.awt.headless=true -Didea.version==2017.1.1 -Xmx768m -Didea.maven.embedder.version=3.3.9 -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA.app/Contents/lib/resources_en.jar:/Applications/IntelliJ IDEA.app/Contents/lib/log4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/snappy-in-java-0.5.1.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna-platform.jar:/Applications/IntelliJ IDEA.app/Contents/lib/annotations.jar:/Applications/IntelliJ IDEA.app/Contents/lib/oromatcher.jar:/Applications/IntelliJ IDEA.app/Contents/lib/trove4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/util.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jdom.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/lucene-core-2.4.1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-server-api.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-common.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/archetype-catalog-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/archetype-common-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/maven-dependency-tree-1.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/nexus-indexer-3.0.4.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/nexus-indexer-artifact-1.0.1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-impl.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-api-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-connector-basic-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-impl-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-spi-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-transport-wagon-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-util-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aopalliance-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/cdi-api-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-cli-1.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-io-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-lang-2.6.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-lang3-3.4.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/guava-18.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/guice-4.0-no_aop.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/javax.inject-1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/jsoup-1.7.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/jsr250-api-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-aether-provider-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-artifact-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-builder-support-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-compat-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-core-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-embedder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-model-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-model-builder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-plugin-api-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-settings-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-settings-builder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/org.eclipse.sisu.inject-0.3.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/org.eclipse.sisu.plexus-0.3.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-component-annotations-1.6.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-interpolation-1.21.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.3.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-utils-3.0.22.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/slf4j-api-1.7.5.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/slf4j-simple-1.7.5.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-file-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-http-2.10-shaded.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-http-shared-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-provider-api-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar org.jetbrains.idea.maven.server.RemoteMavenServer
如何将这三个随机打开的端口绑定到localhost?
注释
==2023年3月28日更新==
使用IntelliJ 2022.3.3(终极版),我没有更多的TCP端口绑定到通配符接口。但是两个UDP端口仍然绑定到通配符接口,如CrazyCoder答案的屏幕截图所示。
IntelliJ IDEA默认情况下不会在通配符接口上绑定任何端口,除了UDP并发许可检查(仅适用于Ultimate)。所有用于内部需求(Netty库初始化、独占文件夹锁、内置Web服务器、调试器、编译器/maven/gradle/运行进程IPC)的端口都在localhost
(127.0.0.1
)接口上打开: