0

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.

Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
  • Don’t put your Eclipse configuration files in source control. – Thorbjørn Ravn Andersen Apr 19 '22 at 21:45
  • @ThorbjørnRavnAndersen The `.project` file is intended to be shared. – howlger Apr 20 '22 at 06:49
  • Does selecting the project folder and hitting F5 help? If you right-click a Maven project and choose _Maven > Update Project..._ will the project be shown in the list of Maven projects? – howlger Apr 20 '22 at 06:53
  • @howlger well, appears that something broke. “ Of course there is no pom.xml file. I am no longer using Maven.” – Thorbjørn Ravn Andersen Apr 20 '22 at 07:02
  • @ThorbjørnRavnAndersen This might be caused by not sharing or sharing a wrong `.project` file. By the way, the `.project` file is not an Eclipse configuration file, but a project configuration/setting file introduced by Eclipse intended to be shared. – howlger Apr 20 '22 at 07:20
  • 1
    @howlger feel free to answer the actual question – Thorbjørn Ravn Andersen Apr 20 '22 at 10:42
  • @howlger No, refreshing does not help. I just created a Maven project. Right-clicking and choosing `Maven > Update Project...` shows only that new project, not the existing one. – Ellen Spertus Apr 20 '22 at 21:00

2 Answers2

1

I had the same issue. What worked for me was deleting my run configurations for my builds and junits. The "Could not read maven project" error went away. Sorry I was too late for you Ellen.

0

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.

Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
  • Please make sure it has been reported to [Eclipse m2e](https://github.com/eclipse-m2e/m2e-core/issues) with instructions on how to reproduce it (telling also which way exactly you have chosen to import the project), best with a patch. – howlger Apr 21 '22 at 06:36
  • In general this process is much easier if you have a Maven project. I do it on an almost daily basis if for some reason I need a fresh workspace. – Thorbjørn Ravn Andersen Apr 22 '22 at 06:56