banner



How To Clean And Build Maven Project In Eclipse

Question

Successful build in Maven still showing errors in Eclipse

*

69947 visibility 0 arrow_circle_up 0 arrow_circle_down


I'm having something quite peculiar here, my build is successful in maven when I type "mvn clean install" however once imported into Eclipse it's showing errors.

See for yourself:

mvn clean install

Eclipse

I guess exluding quartz from the `pom.xml solved the problem but I'd like to know why.


PS: Here is the pom.xml in case you want to see it:

            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>    <groupId>com.thongvan.mpclient</groupId>   <artifactId>MyClient</artifactId>   <version>1.0-SNAPSHOT</version>   <packaging>jar</packaging>    <name>MyClient</name>   <url>http://maven.apache.org</url>    <properties>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>   </properties>    <dependencies>     <dependency>       <groupId>junit</groupId>       <artifactId>junit</artifactId>       <version>3.8.1</version>       <scope>test</scope>     </dependency>     <dependency>         <groupId>com.thongvan.mp</groupId>         <artifactId>MyEjb</artifactId>         <version>1.0-SNAPSHOT</version>     </dependency>     <dependency>         <groupId>org.jboss.jbossas</groupId>         <artifactId>jboss-as-client</artifactId>         <version>5.1.0.GA</version>         <type>pom</type>     </dependency>   </dependencies> </project>                      

EDIT

As you can see quartz is here: quartz


    Answer - 1

    0 arrow_circle_up 0 arrow_circle_down

    The other upvoted answers did not work for me using these versions:

    • Eclipse Neon
    • Maven 3
    • m2e 1.7

    This is what I had to do:

    1. Delete the Eclipse project from Eclipse interface (do not delete project contents on disk)
    2. Go to the project's root directory in a file explorer or terminal
    3. Delete these files: .classpath, .project, and .settings directory
    4. Back to Eclipse, File -> Import... -> Maven -> Existing Maven projects

    by *


      Answer - 2

      0 arrow_circle_up 0 arrow_circle_down

      If you don't see any error in Eclipse project but it keeps showing the red icon on your project name. Try mvn eclipse:eclipse.

      Then select all projects in Eclipse, Right click > Maven > Update projects

      Hope it helps.

      by *


        Answer - 3

        0 arrow_circle_up 0 arrow_circle_down

        Updating maven project after importing it has fixed this issue for me:

        Right click on the project --> Maven --> Update project.

        by *


          Answer - 4

          0 arrow_circle_up 0 arrow_circle_down

          sometimes maven update nor all above works. so check which import statement gives you error, then go particular lib file which is usually in c:user/ur-PC-NAME/.m2 get into package delete that .jar file.

          then in eclipse, right click on project > maven > update maven.

          by *


            Answer - 5

            0 arrow_circle_up 0 arrow_circle_down

            Sometimes the m2e "maintained" eclipse project is out-of-sync with the actual project in POM (There are lots of reason for that). Assume you have using m2e 0.8 or later, right click on the project, under Maven, there are two entries that are usually useful. They are Update Dependencies and Update Project Configuration

            Have a try on them, wait a while after u clicked that for eclipse to update the project and build. Normally it solves similar problems.

            by *


              Answer - 6

              0 arrow_circle_up 0 arrow_circle_down

              You should try mvn eclipse:eclipse

              And then make sure the M2_REPO variable is point to your local repository.

              by *


                Answer - 7

                0 arrow_circle_up 0 arrow_circle_down

                That often happens when the m2eclipse hasn't updated the build path to correspond to what a modified POM file says. There's an entry in the Maven context menu to update the Configuration.

                by *


                  Answer - 8

                  0 arrow_circle_up 0 arrow_circle_down

                  In my case,

                  1. I just deleted project from Eclipse (not ticked checkbox to delete from project location).

                  2. Opened project as "Existing Maven Project" again.

                  and it solved my issue.

                  by *


                    Answer - 9 verified

                    0 arrow_circle_up 0 arrow_circle_down

                    Sometimes I get these types of issues as well.

                    Generally, what worked best for me with Eclipse & Maven:

                    • Use the latest m2e Eclipse plugin
                    • Use Maven 3
                    • Make sure m2e uses the same Maven version as the one you're using on the command line (not the internal one)
                    • Import projects as Maven projects to generate the Eclipse project files

                    by *


                      Answer - 10

                      0 arrow_circle_up 0 arrow_circle_down

                      In my case there were also problems with Java build path like the following: "Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment." Fixing this resolved compilation errors.

                      by *


                        Answer - 11

                        0 arrow_circle_up 0 arrow_circle_down

                        I found that my project was using a project specific Java Compiler setting set to Java 1.5. Furthermore, the project facets were still referencing Java 1.5 when Maven, m2e, Eclipse general Java Compiler settings were all set to Java 1.8.

                        by *


                          Answer - 12

                          0 arrow_circle_up 0 arrow_circle_down

                          Go to Eclipse> Project (Menu) > Clean... > Select project to clean

                          This also removes invalid errors from Eclipse.

                          by *


                            Answer - 13

                            0 arrow_circle_up 0 arrow_circle_down

                            In my case, eclipse starts to show all errors after I changed some versions of dependencies in pom.xml, however the command line mvn clean install build successfully

                            1. I deleted folders of the dependencies I changed manually from the .m2 repositories (in my case everything under org.apache.beam), because I also has corrupted dependency issues.
                            2. mvn clean build the project, this downloaded the dependencies again
                            3. right click project: maven -> update project
                            4. delete the project from eclipse (but not from disk) and reimport (this actually left me with 1 error still, then i delete and reimported again)

                            by *


                              Answer - 14

                              0 arrow_circle_up 0 arrow_circle_down

                              It may help: After upgrading eclipse or changing it or something like, old eclipse specific files (.classpath, .project, and .settings) may not be compatible to the new version of eclipse. So you may have to re generate this eclipse specific files using Maven. So try this in your eclipse project root

                                          mvn eclipse:eclipse                      

                              by *


                                Answer - 15

                                0 arrow_circle_up 0 arrow_circle_down

                                Delete and Re-Import the project in eclipse (without deleting files of course). Unlike other answers I have not looked into why this happens but it works. poof - compilations errors be-gone

                                by *


                                  Answer - 16

                                  0 arrow_circle_up 0 arrow_circle_down

                                  Try to use different/older version of JRE. In my case switching back to JRE7 from JRE8 eliminated the problem.

                                  by *


                                    Answer - 17

                                    0 arrow_circle_up 0 arrow_circle_down

                                    You've a library (quartz-1.5.2.jar) that's reference to your m2 local repository which doesn't exist if you just remove the quartz from your build path and update your dependencies internally(in eclipse) that would solve the problem

                                    by *


                                      How To Clean And Build Maven Project In Eclipse

                                      Source: https://www.titanwolf.org/Network/q/599c7dbd-6271-4b1d-a60e-444a4dd3c05a/y

                                      Posted by: evansagetaing93.blogspot.com

                                      0 Response to "How To Clean And Build Maven Project In Eclipse"

                                      Post a Comment

                                      Iklan Atas Artikel

                                      Iklan Tengah Artikel 1

                                      Iklan Tengah Artikel 2

                                      Iklan Bawah Artikel