-1

enter image description hereenter image description here
I am getting this error on the package statement of my java file:

The declared package "com.myuhc.utiltaglibs" does not match the expected package "bundle.src.main.java.com.myuhc.utiltaglibs"

I am confused what should I setup in the build path or how to get rid of this issue

Also, I am getting cannot be resolved on all the imports.

This thing has got worse. I can't see Build Path under Project → Properties


Just an update I updated my .project file and most of the issues are gone. The only new issue now that I am seeing is The declared package "com.myuhc.utiltaglibs" does not match the expected package ""

Anthon
  • 69,918
  • 32
  • 186
  • 246
user972418
  • 817
  • 3
  • 25
  • 58
  • Please show your code – abarisone Apr 12 '15 at 05:53
  • How did you create your eclipse project? I suspect that you have created it at the parent folder and eclipse has failed to register it as a maven project. – redge Apr 12 '15 at 14:13
  • I checked out the project from git. Does that have anything to do with Java Build Path. – user972418 Apr 12 '15 at 15:58
  • It is difficult to tell without seeing your folder structure but I suspect that it is a maven project and the eclipse project is created at the wrong folder. This would stop eclipse from recognizing it as a maven project. do you have many folders with the same structure as "bundle" in your project? also do you have a pom.xml file in the bundle folder? – redge Apr 12 '15 at 23:55
  • That ..does not match "" error is a red herring. Close the file, reopen and clean the project will fix it. It typically occurs after a Maven project src path has been changed. – kiwiron Apr 13 '15 at 09:42

2 Answers2

0

I have solved the issue. I manually edited the .project file to look somewhat like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>myuhc</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.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>
user972418
  • 817
  • 3
  • 25
  • 58
0

I suspect that what you have is a maven project with modules. If so you may have another pom file in the content folder. You should be able to import these into eclipse without making manual edits of the Eclipse files.

With the code checked out of git using another client you should be able to import maven projects into eclipse and have them just work. Making manual edits means that you have not got the project setup the way it was intended and this may have some unintended consequences for your development process.

Have a look at this answer

Community
  • 1
  • 1
redge
  • 1,182
  • 7
  • 6