score:-1

for example if there are 4 project and a root project, add the other child projects to build path of root project. if there is not selection of build path, add below codes to .project file.

<?xml version="1.0" encoding="utf-8"?>
<projectdescription>
    <name>rootproject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildspec>
        <buildcommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildcommand>
        <buildcommand>
            <name>org.eclipse.m2e.core.maven2builder</name>
            <arguments>
            </arguments>
        </buildcommand>
    </buildspec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.m2e.core.maven2nature</nature>
    </natures>
</projectdescription>

score:0

like the message says, is the file somewhere on the project's java build path (e.g. a source folder)?

score:0

had the same problem. solution: context menu -> maven -> enable dependency management

do not know why that was lost, when checking out.

score:0

i found that i was getting this error due to having my files, including my main class, outside of the .src folder.

score:0

what worked for me was copping the .settings/ directory from another project.

score:0

run "mvn eclipse:eclipse" from terminal.

score:0

if you're a beginner (like me), the solution may be as simple as making sure the parent folder that the file you're working in is a java project.

i made the mistake of simply creating a java folder, then creating a file in the folder and expecting it to work. the file needs to live in a project if you want to avoid this error.

score:0

i had same issue after importing maven project consisting of nested micro services. this is how i got it resolved in eclipse:

  1. right click on project
  2. select configure
  3. select "configure and detect nested projects"

score:0

i solved this by adding projects in java build path

right click on the project -> properties -> java build path -> add

enter image description here

score:1

your source files should be in a structure with a 'package' icon in the package explorer view (in the menu under window > show view > package explorer or press ctrl+3 and type pack), like this:

java project in eclipse

if they are not, select the folder containing your root package (src in the image above) and select use as source folder from the context menu (right click).

score:1

here the steps for creating a source folder in eclipse.

  1. right click on the project and go to properties
  2. select "java build path" from the properties dialog box
  3. select the source tab and check that the source folders are correct if not click on the remove button to remove source folders, or the add button to add source folders.

you can control the order in which source folders appear in a project on order and export tab on the configure build path option.

score:1

had the same problem (but with maven). the reason was incorrect choice of executor: my project used global settings that are not avilable from embedded installation of maven. changed it to external (window -> preferences -> maven -> installations) and that fixed the problem.

score:1

what i did is after importing the project from svn , deleted the project from workspace and imported it as a maven project from local . then in preferences->maven->usersettings->in usersettings box gave path of settings.xml which will be in apache maven folder-> conf->settings.xml

and it solved the issue for me.

score:2

i did copy the .classpath and .project from another project and adjusted the values properly.

close the project before editing those files, when you are sure they reflect the reality (your reality anyway), re-open the project in eclipse.

the workspace is rebuilt and all should work from then on.

score:2

in my case it's a maven project

delete the project from eclipse leaving the sources close eclipse delete from filesystem

.target/ .classpath .project .settings/ open eclipse again import maven projects

this solved the problem

score:2

you may want to try running eclipse with the -clean startup option - it tries re-building eclipse's metadata of the workspace.

score:2

mvn eclipse:eclipse

solved my problem

score:4

did you have your .project file in your folders?

i got the same problem. than i realized that i didn't have the .project file.

score:4

i might be picking up the wrong things from so many comments, but if you are using maven, then are you doing the usual command prompt build and clean?

go to cmd, navigate to your workspace (usually c:/workspace). then run "mvn clean install -dskiptests"

after that run "mvn eclipse:eclipse eclipse:clean" (don't need to worry about piping).

also, do you have any module dependencies in your projects?

if so, try removing the dependencies clicking apply, then readding the dependencies. as this can set eclipse right when it get's confused with buildpath sometimes.

hope this helps!

score:5

i also had this problem after converting my java project into a maven project. i solved it as follows:

right click on your project ->project facets -> click on java, then apply.

score:10

i have this issue from time-to-time and often it's because the project wasn't marked as a java project. you can change this by going to the properties for the project > project facets > and selecting java. you may then need to properly configure that project, but this is probably part of the problem

score:17

what i did to make one of my projects to check out properly is by

1) import your project from svn

      file-->import-->svn-checkout projects from svn

2) find your project and then in the "check out as" dialogue make sure you have the radio button selected "check out as a project configured using the new project wizard"

3) go through regular steps.

the wizard pulls the project properly and then setups your eclipse....

without using the wizard i find that all hell breaks loose.....

hope this helps...

score:17

this is what was missing in my .project file:

    <projectdescription>
        ...
        <buildspec>
            <buildcommand>
                <name>org.eclipse.jdt.core.javabuilder</name>
                <arguments>
                </arguments>
            </buildcommand>
        </buildspec>
        ...
        ...
        ...
        <natures>
            <nature>org.eclipse.jdt.core.javanature</nature>
            <nature>org.eclipse.m2e.core.maven2nature</nature>
        </natures>
        ...
    </projectdescription>

score:136

when you have a multimodules maven project under a parent project, make sure you're not editing the file in the maven parent project.


Related Query

More Query from same tag