Search code examples
javaeclipsemavenbuildpath

Eclipse error: "Could not read maven project" for non-Maven project


I have a git Eclipse project that used to use Maven. I created a new Eclipse project on one computer, imported the source code, and successfully built it. I then committed and pushed my changes to GitHub.

When I cloned the project on another computer (OS X) and imported it, I get this error when I try building:

Could not read maven project

When I click for additional details, I see:

Could not read maven project
Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /Users/spertus/src/wordui/pom.xml: /Users/spertus/src/wordui/pom.xml (No such file or directory) @ 

Of course there is no pom.xml file. I am no longer using Maven.

When I open the project Properties, the only item listed under Project Natures is Java.

Here is the .project file:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>wordui</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

I have tried reopening Eclipse, cleaning the project, and deleting and reimporting it, to no effect.

I don't think .classpath should matter, but here it is:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/javafx-jre17">
        <attributes>
            <attribute name="module" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Wordnik API"/>
    <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX 17"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

I am using Eclipse for Java Developers 2022-03. The run configuration is under Java Application.


Solution

  • I was not able to fix the problem, but I was able to work around it by:

    1. Creating a brand new Java project.
    2. Importing the old source code.
    3. Adding the libraries.
    4. Running with the default run configuration.

    In other words, if you get to this state, create a new project.