无法在Intellij中导入Maven项目

时间:2018-11-19 14:55:04

标签: java maven intellij-idea

我正在尝试使用Maven导入本地jar文件,但是看来Maven服务拒绝启动,因此,当我进行任何更改时,我无法将其重新导入(不知道造成的更改是什么)这个)。

每当我尝试重新导入某些内容时,这就是idea.log文件的输出:

2018-11-19 16:44:24,363 [3648709]   WARN -
ution.rmi.RemoteProcessSupport - Unrecognized option: -d64 2018-11-19
16:44:24,363 [3648709]   WARN - ution.rmi.RemoteProcessSupport -
Error: Could not create the Java Virtual Machine. 2018-11-19
16:44:24,363 [3648709]   WARN - ution.rmi.RemoteProcessSupport -
Error: A fatal exception has occurred. Program will exit. 2018-11-19
16:44:24,402 [3648748]   WARN - ution.rmi.RemoteProcessSupport -
Unrecognized option: -d64 2018-11-19 16:44:24,402 [3648748]   WARN -
ution.rmi.RemoteProcessSupport - Error: Could not create the Java
Virtual Machine. 2018-11-19 16:44:24,402 [3648748]   WARN -
ution.rmi.RemoteProcessSupport - Error: A fatal exception has
occurred. Program will exit. 2018-11-19 16:44:24,402 [3648748]  ERROR
-      #org.jetbrains.idea.maven - Cannot reconnect. java.lang.RuntimeException: Cannot reconnect.  at
org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
    at
org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:526)
    at
org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:394)
    at
org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:103)
    at
org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:62)
    at
org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:643)
    at
org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:554)
    at
org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:463)
    at
org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:442)
    at
org.jetbrains.idea.maven.project.MavenProjectsProcessorReadingTask.perform(MavenProjectsProcessorReadingTask.java:64)
    at
org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:132)
    at
org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:32)
    at
org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:107)
    at
org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:446)
    at
com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
    at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745) Caused by:
java.rmi.RemoteException: Cannot start maven service; nested exception
is:     com.intellij.execution.ExecutionException: Unrecognized option:
-d64 Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

at
org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:161)
at
org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:66)
at
org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
at
org.jetbrains.idea.maven.server.MavenServerManager.lambda$applyProfiles$3(MavenServerManager.java:526)
at
org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
    ... 19 more
    Caused by: com.intellij.execution.ExecutionException: Unrecognized option: -d64 Error: Could not create the Java Virtual
Machine. Error: A fatal exception has occurred. Program will exit. at
com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:160)
at
org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:158)
23 more 2018-11-19 16:44:24,403 [3648749]  ERROR -     
#org.jetbrains.idea.maven - IntelliJ IDEA 2018.1.5  Build #IU-181.5281.24 2018-11-19 16:44:24,403 [3648749]  ERROR -      #org.jetbrains.idea.maven - JDK: 1.8.0_152-release 2018-11-19 16:44:24,403 [3648749]  ERROR -
#org.jetbrains.idea.maven - VM:
OpenJDK 64-Bit Server VM 2018-11-19 16:44:24,403 [3648749]  ERROR -   
#org.jetbrains.idea.maven - Vendor: JetBrains s.r.o 2018-11-19 16:44:24,403 [3648749]  ERROR -      #org.jetbrains.idea.maven - OS:
Mac OS X 2018-11-19 16:44:24,403 [3648749]  ERROR -     
#org.jetbrains.idea.maven - Last Action: SaveAll

我什至不能按照这个来启动Maven-这是我pom.xml中的相关部分:

  <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>dummy</groupId>
    <artifactId>dummy</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>local-maven-repo</id>
            <url>file:///${project.basedir}/local-maven-repo</url>
        </repository>
    </repositories>

    <properties>
        <maven.compiler.source>1.10</maven.compiler.source>
        <maven.compiler.target>1.10</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.10</source>
                    <target>1.10</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

如果还有其他需要,我会上传。

2 个答案:

答案 0 :(得分:1)

是您遇到了此错误,还是防火墙导致了问题?

BUG:https://youtrack.jetbrains.com/issue/IDEA-195143

答案 1 :(得分:0)

在以下位置重新定义JDK: 设置->构建,执行,部署->构建工具-> Maven

并定义: 导入>进口商的JDK Runner> JRE

和中: 项目结构>项目> Project SDK

定义: 平台设置> SDK

,然后尝试运行“ maven clean”或失败的命令。