Reputation: 2621
I've created a Maven project, of packaging type "jar", called "Y" I've done "Maven install", and I could find it in my local repository..
Then, I've created another project, of packaging type "war", called "X". In this project, I added a dependency to "Y" jar, as follows :
<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 receive this error :
Project 'X' is missing required Java project: 'Y'
But, it doesn't say "missing artifact"... and in all the cases, when I try to deploy "X" I get this : java.lang.ClassNotFoundException:
for every class that I have in project "Y" and used in the project "X"...
Upvotes: 20
Views: 40034
Reputation: 351
OK, if the above does not work, try the following. It worked for me.
Moral of the story: Periodically save .metadata and .recommenders of your project. They may be useful.
Why the problem happened: I added project Y to Project X and then removed it. Eclipse did not properly and fully remove Y and began to complain as above.
Versions and configuration: Eclipse Neon. Legacy. No maven etc.
What worked: 0) Exit eclipse.
1) Made a copy of the entire directory of X. To be on the safe side.
2) deleted the above two . directories.
3) Copied old saved versions of these directories to replace the deleted versions.
4) Restarted Eclipse. It made some routine complains. But I did the following:
4.1) Clean 4.2) Refresh 4.3) Build all
5) It worked. I exited and restarted Eclipse many times to make sure that the problem does not reappear. So far so good.
Upvotes: 1
Reputation: 32076
I've seen this error in the past; You mentioned eclipse, so it may be related to moving an Eclipse project from one workspace to another.
Check .classpath
and .project
files for links to invalid directory resources; adjust as needed:
<linkedResources>
<link>
<name>.link_to_something</name>
<type>2</type>
<location>C:/Users/user/projects/someproject/plugins</location>
</link>
</linkedResources>
Upvotes: 5
Reputation: 8058
This error message means that one of your eclipse projects has a dependency on another one. which you haven't set up or which isn't open. Either modify the Eclipse build path so it no longer requires that other project (replace that dependency with a reference to a jarfile or other source of the code/resources being used), or get that project set up.
Upvotes: 1
Reputation: 2621
Thank you @Eldad, your comment helped me to detect the problem.
Under Eclipse IDE : Right click on "X" project > Build Path > Configure Build Path > Project > Check Y > Click on "Remove"
Now no error while deploying the X war.
Upvotes: 35