14

I made imported a project to eclipse and I have a lot of errors in every class name even classes like String ...

the error in the classes I made is Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor

and inside the methods <Class> cannot be resolved to a type even to IOException I am getting IOException cannot be resolved to a type

so what should I do ? I tried to build , clean again with no use

UPDATE : also I am getting Description

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (execution: default-resources, phase: process-resources)   pom.xml /test line 6    Maven Project Build Lifecycle Mapping Problem
Peril
  • 1,569
  • 6
  • 25
  • 42
  • check if maven failed to download dependencies. – sudmong Oct 03 '11 at 17:37
  • how can I do that ? update dependencies ? – Peril Oct 03 '11 at 17:38
  • 1
    Go to Project->Properties->Java build path->Libraries. Is the JRE System Library added? Does it point to the correct location? – Hari Menon Oct 03 '11 at 17:39
  • in pom.xml file. it will have list of dependencies. see if all are downloaded under .m2 folder in %user% folder in windows. – sudmong Oct 03 '11 at 17:39
  • @Raze2dust I am getting Build path entry is missing: org.ec....launcher.StandardVMType/JavaSE-1.7 – Peril Oct 03 '11 at 17:40
  • possible duplicate of [How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds](http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-spring) – Matthew Farwell Oct 03 '11 at 17:41
  • @sudmong sorry this is the first time I am using mavan , I have the dependices on the lib under WEB-INF in webapp folder , should I added them manually to pom.xml I am using OS X Thanks – Peril Oct 03 '11 at 17:41
  • How did you import to Maven? Did you try `mvn eclipse:eclipse`. I think you have directly imported them. Try doing `mvn eclipse:eclipse` – Hari Menon Oct 03 '11 at 17:42
  • error in pom.xml /test line 6 – sudmong Oct 03 '11 at 17:43
  • I just tried it , it gives me build faild , I have the file it has only one class for entites – Peril Oct 03 '11 at 17:44
  • What precisely did you do to 'make imported'? Without this no one can help you. – bmargulies Oct 03 '11 at 17:48
  • my friend sent me the zipped file , I tried to import it using eclipse maven plugin but I am getting these errors I tried to make mvn eclipse:eclipse and even mvn package but I am getting build faild – Peril Oct 03 '11 at 17:52

4 Answers4

18

The project that you imported is a Maven project. What you should do is open the pom.xml file located in the root of the project and add the following plugin in the plugin management part of the file:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-resources-plugin</artifactId>
                                    <versionRange>[2.0,)</versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>testResources</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Then right click the project, go to Maven and Update project configuration.

This should fix it.

Sinisha Mihajlovski
  • 1,811
  • 1
  • 20
  • 34
  • 1
    This is "hard fix", thank you for it. But this problem was and is not present in other Eclipse + m2e installations (such as with my colleagues). Can you explain why this problem has appeared? – Rade_303 Dec 23 '11 at 16:24
  • 1
    Nevermind, I read this POS here http://wiki.eclipse.org/M2E_plugin_execution_not_covered I'm very dissatisfied with this lifecycle mapping thing. – Rade_303 Dec 23 '11 at 17:08
  • Probably easier to re-import the Maven project — Then you get a dialog where you can choose “Do not Execute” to fill in the pom. – Martin Jan 21 '14 at 07:32
4

I think that your problem is not in maven project and not in import procedure but in your eclipse configuration. It seems that your eclipse "does not see" correct JDK.

So, first try to create the simple "hello world" project and see if it works. When this works import your maven project again, i.e. run command mvn eclipse:eclipse and then open the project using eclipse. If this is your first eclipse project you have to create M2_REPO variable that will refer to your maven repository (USER_HOME/.m2/repository)

If you still have problems try to refresh and clean the project.

If the problem still happens compare which JDK are you using in "good" and "bad" project. I believe that you will see difference there. So, fix it.

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • I have a simple class with few fields called entity , i tried to use mvn eclipse:eclipse but I am getting No plugin found for prefix 'eclipse' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the re – Peril Oct 03 '11 at 17:46
3

Were you able to build the project successfully.. If so, don't import it..again run @ project root level;

#mvn eclipse:eclipse -o  

This will create a eclipse project.Then 'import as existing project.' All classpath problem will get solved..But you need to set your .m2 home as a variable in your build path..

Ratha
  • 9,434
  • 17
  • 85
  • 163
  • I am getting [ERROR] No plugin found for prefix 'eclipse' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/comp/.m2/repository), central (http://repo1.maven.org/maven2)] -> [Help 1] – Peril Oct 03 '11 at 17:47
  • Try updating your maven install..I forgot the command..It is something like; #mvn update... and again try to build the project – Ratha Oct 03 '11 at 18:12
3

Go to Project->Properties->Java build path->Libraries. Is the JRE System Library added? Does it point to the correct location?

Also try running mvn eclipse:eclipse on the root folder of the project (You will need to download maven and add it to the classpath first).

Hari Menon
  • 33,649
  • 14
  • 85
  • 108
  • `mvn eclise:eclipse` is what did it for me, thank you. Dunno why I had to do it on this checkout and not on any other checkouts. – Marvo Feb 24 '13 at 00:21