I import https://github.com/pf4j/pf4j to Eclipse 4.27.0 with M2E plugin installed and got bunch of errors in test folder:
Description Resource Path Location Type
AbstractExtensionFinder cannot be resolved AbstractExtensionFinderTest.java /pf4j/src/test/java/org/pf4j line 260 Java Problem
AbstractExtensionFinder cannot be resolved AbstractExtensionFinderTest.java /pf4j/src/test/java/org/pf4j line 273 Java Problem
AbstractExtensionFinder cannot be resolved to a type AbstractExtensionFinderTest.java /pf4j/src/test/java/org/pf4j line 75 Java Problem
AbstractExtensionFinder cannot be resolved to a type AbstractExtensionFinderTest.java /pf4j/src/test/java/org/pf4j line 97 Java Problem
...
Wherein from cmd the project is compiled by maven without errors and Intellij Idea imports the project without errors. What is the problem with Eclipse?
UPD I see now, that code in src/main/java are shown as folders not packages, and it is strange, because in test folder it is shown as packages as it should be.
UPD Java Build Path / Sources seems is ok.
Several problems with this project in m2e:
maven.compiler.release=1.8
, while child module does "module stuff" (java9+)..which confuses m2e. (, me2 completely:) (Current master version) Does the following after every "project import/maven update":
(This is "too narrow/few" includes,) Which explains eclipse "Problems".
To fix it (temporarily) we can remove these includes:
For a permanent fix: pf4j and m2e have to "meet" somehow:)
I propose (herewith):
<profiles>
<profile>
<id>j9</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<!-- compile module-info.java for Java 9+ -->
<execution>
<id>java9-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<multiReleaseOutput>true</multiReleaseOutput>
<includes>
<include>module-info.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...to move the "exotic (to blame) compilation" to a "custom profile".
This enables:
(makes both happy)
For the "demo modules" it is sufficient to "switch off (m2e) workspace resolution"/fix pf4j module;)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.