Java Resources Folder Error In Eclipse

27,740

Solution 1

Well, it might just be because there are some folders containing classes which are treated as source folders by maven (that's why the maven command line compile works) but not as such when using .m2 eclipse plugin to import your project into eclipse.

Here's some things you might try:

in the properties of your eclipse project, go to java build path, select sources, and check to see if all needed source fodlers are added (as source folders). If some are missing, just add them manually using add sources... button

Sometimes, once you do a maven clean in the command line, the eclipse project will show errors because it no longer finds the compiled classes (they were cleaned by maven). Doing a Project-> clean on your eclipse project usually solves this

Try adding the project into eclipse as a plain ole eclipse project: do a mvn eclipse:eclipse, then import it into eclipse as eclipse project (not maven project)

Solution 2

This is the problem with Eclipse some times when you build the project from Terminal. There are a few common steps that we need to apply to solve these kinds of problems.

  1. Choose Project and clean option from the menu option
  2. Right Click on Project --> Maven --> Update project

Either one should work definitely.

Share:
27,740
Mahmoud Saleh
Author by

Mahmoud Saleh

I am Mahmoud Saleh an Enthusiastic Software Engineer, Computer Science Graduate, Experienced in developing J2EE applications, Currently developing with Spring,JSF,Primefaces,Hibernate,Filenet. Email: [email protected] Linkedin: https://www.linkedin.com/in/mahmoud-saleh-60465545? Upwork: http://www.upwork.com/o/profiles/users/_~012a6a88e04dd2c1ed/

Updated on October 22, 2020

Comments

  • Mahmoud Saleh
    Mahmoud Saleh over 3 years

    i am importing a spring maven project in eclipse (helios with maven plugin) i built the project in terminal, and everything is ok, and eclipse shows no errors in xml or java classes, but still it shows an error mark on Java Resources Folder, no idea why ? any ideas ?

  • Mahmoud Saleh
    Mahmoud Saleh over 12 years
    well i used mvn eclipse:eclipse and nothing new, also i checked what's in the sources folder in build path: src/main/java , src/main/resources, src/test/java, please advise.
  • Shivan Dragon
    Shivan Dragon over 12 years
    You need to give us at least the exact error message that eclipse is giving you, and maybe also your project's pom
  • Mahmoud Saleh
    Mahmoud Saleh over 12 years
    the strange thing is that there's no error message, where i can find it ?
  • Shivan Dragon
    Shivan Dragon over 12 years
    If you click on the "Markers" tab in the lower part of your eclipse window, you have no error message listed there?
  • Mahmoud Saleh
    Mahmoud Saleh over 12 years
    found it thanks, here it's: Could not calculate build plan: The repository system is offline but the artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository.
  • Shivan Dragon
    Shivan Dragon over 12 years
    That means that the maven command used by your eclipse maven plugin uses the "-o" switch which forces maven to work in offline mode, which means he can't download missing dependencies (such as maven resources plugin). What's strange is that you say that you've managed to succesfully build the project from the command line (i'm guessing you did a mvn clean install). If that's true, maven should have already downloaded all the needed dependencies in the local repo. Try this: right click on project ->maven->enable/disable dependency management
  • Mahmoud Saleh
    Mahmoud Saleh over 12 years
    i thinks that better is to open a new thread about this maven error.
  • Nallamachu
    Nallamachu over 4 years
    If there is any environment problem, the build should failed in the terminal only. In this case, it didn't happen so this is not the right solution.