Project “X” does not have the required Java project: “Y”

I created a Maven project, the packaging type is "jar" called "Y", I did a "Maven install", and I was able to find it in my local repository.

Then I created another project like war packing called X. In this project, I added a dependency on the "Y" jar, as shown below:

<dependency> <groupId>my.pck</groupId> <artifactId>Y</artifactId> <version>0.0.1-SNAPSHOT</version> <type>jar</type> </dependency> 

My problem is that when I close the project "Y", I get this error:

 Project 'X' is missing required Java project: 'Y' 

But he does not say “missing artifact” ... and in all cases when I try to expand “X”, I get the following: java.lang.ClassNotFoundException: for every class that I have in the project “Y” and used in project "X" ...

+6
source share
4 answers

Thanks @Eldad, your comment helped me spot the problem.

In the Eclipse IDE: Right-click the project "X"> Build Path> Configure Build Path> Project> Verify Y> Click Delete

Now there are no mistakes when deploying the X-war.

+19
source

I have seen this mistake in the past; You mentioned eclipse, so this could be due to moving the Eclipse project from one workspace to another.

Check .classpath and .project files for links to invalid directory resources; adjust as necessary:

 <linkedResources> <link> <name>.link_to_something</name> <type>2</type> <location>C:/Users/user/projects/someproject/plugins</location> </link> </linkedResources> 
+3
source

This error message means that one of your eclipse projects has a dependency on the other. which you have not configured or which are not open. Either change the Eclipse build path so that it no longer requires this other project (replace this dependency with a link to jarfile or another source of used code / resources), or create this project.

+1
source

OK, if the above does not work , try the following. It worked for me.

The moral of the story . Periodically save metadata and reviewers for your project. They may be helpful.

Why the problem arose. . I added project Y to Project X and then deleted it. Eclipse did not correctly and completely remove Y and started complaining as above.

Versions and configuration : Eclipse Neon. Heritage. No maven etc.

What worked : 0) Close eclipse.

1) Made a copy of the entire X directory. To be safe.

2) deleted the above two. directories.

3) Copy the old saved versions of these directories to replace deleted versions.

4) Restart Eclipse. He made several routine complaints. But I did the following:

4.1) Clear 4.2) Update 4.3) Build all

5) It worked. I went out and restarted Eclipse many times to make sure that the problem does not appear again. So far so good.

+1
source

All Articles