Eclipse project import crashs
ahoehma opened this issue · comments
I'm trying to import latest version of swagger into eclipse for development ... but this fails wiith:
An internal error occurred during: "Importing Maven projects".
class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @2e7de658)
Anyone here with the same?
I'm using eclipse:
Spring Tool Suite 4
Version: 4.22.0.RELEASE
Build Id: 202403071427
Revision: 44291b464093d161f115d8e16059e5272ed3c81d
Lombok v1.18.32 "Envious Ferret" is installed. https://projectlombok.org/
m2e: 2.6.0.20240220-1109
Hmmm ... maybe its my mistake?!
I configure now a jdk8 for the eclipse workspace (before this I have only a jdk17 defined) ... the eclipse itselfs runs with opendjk 22.
Now I can import the projects into eclipse but at the end I see everywhere:
Could not update project swagger-annotations-jakarta configuration
Path must include project and resource name: /
M2E Import doing some rounds ... now I have this final import state ... I'm not really sure if this is "okay". Any hint?
Specially these warnings not really clear to me:
Access "D:\Dev\git\privat\swagger-core" directory outside of project base directory. (org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources:default-resources:process-resources)
And this error:
Failed to execute mojo org.apache.maven.plugins:maven-dependency-plugin:3.6.1:copy-dependencies {execution: copy-deps} (org.apache.maven.plugins:maven-dependency-plugin:3.6.1:copy-dependencies:copy-deps:package)
org.eclipse.core.runtime.CoreException: Failed to execute mojo org.apache.maven.plugins:maven-dependency-plugin:3.6.1:copy-dependencies {execution: copy-deps}
..
Caused by: org.apache.maven.plugin.MojoExecutionException: Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187.
at org.apache.maven.plugins.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:149)
(see https://issues.apache.org/jira/browse/MDEP-187)
I found a temp. workaround!
I commented out the 2 extra resources in main pom.xml and swagger-project-jakarta pom.xml
<!--
<resource>
<targetPath>META-INF</targetPath>
<directory>../..</directory>
<filtering>true</filtering>
<includes>
<include>NOTICE</include>
<include>LICENSE</include>
</includes>
</resource>
-->
Then the import into eclipse works fine. These relative path's are a problem (for eclipse / m2e).
I tried with:
<directory>${project.basedir}/../..</directory>
Not working.
I think for a always working setup this resource must be defined only once in top-level pom and the directory must be an absolute path, which is not possible with pure maven. But there is a plugin for such things: https://github.com/jdcasey/directory-maven-plugin.