0

The scenario:
I installed Eclipse on new computer, and have used workspace from old-version >

I have get an annoying message about not-exist project - so by one solution I saw , I have removed the .metadata folder from the workspace. >>

Since then I am trying to build my project (it has worked well until now), maven run the process with "Build Success" , but any package have not installed, and in sequence to that I'm getting a lot of compiling errors.

My pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.lingar</groupId>
    <artifactId>SocialEventsTrying1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SocialEventsTrying1</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <!-- Use MySQL Connector-J -->

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.47</version><!-- this version  solve the time issue -->
        </dependency>
        
        
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build> 
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!-- tag::frontend-maven-plugin[] -->
            
            <!-- end::frontend-maven-plugin[] -->
        </plugins>
    </build>
    

</project>

Maven console logs:

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< com.lingar:SocialEventsTrying1 >-------------------
[INFO] Building SocialEventsTrying1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ SocialEventsTrying1 ---
[INFO] Deleting C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\target
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ SocialEventsTrying1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 59 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ SocialEventsTrying1 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 31 source files to C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\target\classes
[INFO] /C:/izhar/files/eclipse-workspaces/Spring-Hibernate/HibernateStudying/src/main/java/com/lingar/SocialEvents/tutorial/services/TutorialService.java: C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\src\main\java\com\lingar\SocialEvents\tutorial\services\TutorialService.java uses or overrides a deprecated API.
[INFO] /C:/izhar/files/eclipse-workspaces/Spring-Hibernate/HibernateStudying/src/main/java/com/lingar/SocialEvents/tutorial/services/TutorialService.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/izhar/files/eclipse-workspaces/Spring-Hibernate/HibernateStudying/src/main/java/com/lingar/SocialEvents/tutorial/services/TutorialService.java: C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\src\main\java\com\lingar\SocialEvents\tutorial\services\TutorialService.java uses unchecked or unsafe operations.
[INFO] /C:/izhar/files/eclipse-workspaces/Spring-Hibernate/HibernateStudying/src/main/java/com/lingar/SocialEvents/tutorial/services/TutorialService.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ SocialEventsTrying1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ SocialEventsTrying1 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ SocialEventsTrying1 ---
[INFO] 
[INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) @ SocialEventsTrying1 ---
[INFO] Building jar: C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\target\SocialEventsTrying1-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.3.RELEASE:repackage (repackage) @ SocialEventsTrying1 ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ SocialEventsTrying1 ---
[INFO] Installing C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\target\SocialEventsTrying1-0.0.1-SNAPSHOT.jar to C:\Users\Lingar\.m2\repository\com\lingar\SocialEventsTrying1\0.0.1-SNAPSHOT\SocialEventsTrying1-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\izhar\files\eclipse-workspaces\Spring-Hibernate\HibernateStudying\pom.xml to C:\Users\Lingar\.m2\repository\com\lingar\SocialEventsTrying1\0.0.1-SNAPSHOT\SocialEventsTrying1-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  20.691 s
[INFO] Finished at: 2020-04-28T10:21:26+03:00
[INFO] ------------------------------------------------------------------------

Eclipse version:

Eclipse IDE for Enterprise Java Developers.

Version: 2020-03 (4.15.0)

BTW - It happens in other projects and other work-spaces too, not only in that, so it's general problems. (I have also try to make new workspace and to import the project to there - didn't solved).

Nimantha
  • 6,405
  • 6
  • 28
  • 69
lingar
  • 477
  • 1
  • 7
  • 25
  • 1
    Create a new workspace. – Thorbjørn Ravn Andersen Apr 28 '20 at 07:33
  • And to import the project to there - I have tried, the issue persist... ? @ThorbjørnRavnAndersen – lingar Apr 28 '20 at 07:35
  • 1
    Delete the contents of .m2 folder and try maven update -> force update of snapshot and releases. – Dusayanta Prasad Apr 28 '20 at 07:38
  • 1
    And import your sources anew from your version control. What you currently have is broken. – Thorbjørn Ravn Andersen Apr 28 '20 at 07:58
  • @DusayantaPrasad thanks, seems it solved the problem, but the Eclipse still shows errors on the classes from some reason, seems he isn’t read Lombok – lingar Apr 28 '20 at 08:51
  • 1
    Refresh the project or try restarting the Eclipse Editor once. Also, post the final errors which you are getting. Don't forget to upvote the comment if it was helpful – Dusayanta Prasad Apr 28 '20 at 08:59
  • Those errors are complains about missing methods (that actually Lombok injects them). Like : "The constructor TestData(String, String, String, null, String) is undefined" . I have tried what you suggested, also try to remove from workspace and import again like suggested here - https://stackoverflow.com/a/25218023/9727918 (notice! not to delete the sources) but didn't solved @DusayantaPrasad thanks – lingar Apr 28 '20 at 09:13
  • Solved, see the answers – lingar Apr 28 '20 at 09:54
  • Lombok does very nice things in very questionable ways. I would strongly recommend finding another solution which works the way that the Java architects want you to do things. – Thorbjørn Ravn Andersen Apr 28 '20 at 12:00
  • @DusayantaPrasad If you angle for upvotes, it works a lot better to write full answers. – Thorbjørn Ravn Andersen Apr 28 '20 at 12:15
  • @ThorbjørnRavnAndersen Thanks for the advice. The solution/answer seemed too small to post it as an answer – Dusayanta Prasad Apr 28 '20 at 14:19

2 Answers2

1

Go to your project folder -> open terminal/cmd -> do mvn clean

Now go to eclipse, press ctrl+f5 (maven update) and do it.

Then build your project again. And check if errors still persist.

This will solve your problem of not able to download required jars.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
semicolon
  • 487
  • 2
  • 7
0

Solution :

Thanks guys, this @Dusayanta Prasad solution solved me the problem :

Delete the contents of .m2 folder and try maven update -> force update of snapshot and releases.

Step-1

Step 2-

Eclipse still showed error-warnings on the classes from some reason, seems he isn’t read Lombok, but it’s run ok. So I did this solution (also tried to remove and import and delete .project – those didn’t helped) and install Lombok plugin.

Then after new maven build clean install , and maven > update project – the error warnings gone.

Notice: When installing Lombok plugin and you want to check the Eclipse about to see it installed, sometimes you need to resize the window for showing it (I didn’t found it at beginning) . notice

lingar
  • 477
  • 1
  • 7
  • 25
  • 1
    Deleting Eclipses own files in .project and .settings is pretty much asking for problems. I think you should be less eager to pull the carpet away under Eclipse in the future. – Thorbjørn Ravn Andersen Apr 28 '20 at 17:18
  • U right, at first I have deleted .metadata which also was a rush move @ThorbjørnRavnAndersen – lingar Apr 29 '20 at 09:42