Eclipse Oxygen这个编译单元不在java项目的构建路径上

时间:2021-09-23 11:04:08

I have created a Kafka Streams Project using Maven Archetype:

我使用Maven Archetype创建了一个Kafka Streams项目:

mvn archetype:generate \
-DarchetypeGroupId=org.apache.kafka \
-DarchetypeArtifactId=streams-quickstart-java \
-DarchetypeVersion=1.0.0 \
-DgroupId=streams.examples \
-DartifactId=streams.examples \
-Dversion=0.1 \
-Dpackage=myapps

Compiling and running the program:

编译并运行程序:

> mvn clean package
> mvn exec:java -Dexec.mainClass=myapps.Pipe

The program works fine.

该程序工作正常。

However when I am editing the code and try Ctrl+Space I am getting Cannot perform operation error:

但是,当我编辑代码并尝试Ctrl + Space时,我收到无法执行操作错误:

This compilation unit is not on build path of java project.

See the image below:

见下图:

Eclipse Oxygen这个编译单元不在java项目的构建路径上

1 个解决方案

#1


2  

Just run

mvn eclipse:eclipse

in the project directory and refresh your project in eclipse: File -> Refresh

在项目目录中并在eclipse中刷新项目:File - > Refresh

#1


2  

Just run

mvn eclipse:eclipse

in the project directory and refresh your project in eclipse: File -> Refresh

在项目目录中并在eclipse中刷新项目:File - > Refresh