2

I tried configuring spring framework in eclipse. And try building a sample. It is giving me the following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project springBootHelloWorld: Compilation failure

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

[ERROR] Failed to execute goal on project springBootHelloWorld: Could not resolve dependencies for project com.javaInUse:springBootHelloWorld:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.springframework:spring-core:jar:5.0.10.RELEASE, org.xmlunit:xmlunit-core:jar:2.5.1: Could not transfer artifact org.springframework:spring-core:jar:5.0.10.RELEASE from/to central (https://repo.maven.apache.org/maven2): C:\Users\jkalansrayan.m2\repository\org\springframework\spring-core\5.0.10.RELEASE\aether-f4279e83-b0c7-471b-8dca-f684b2238c2d-spring-core-5.0.10.RELEASE.jar-in-progress (The system cannot find the file specified) -> [Help 1]

POM FILE

<?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>

<groupId>com.javaInUse</groupId>
<artifactId>springBootHelloWorld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springBootHelloWorld</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>
James Z
  • 12,209
  • 10
  • 24
  • 44
user10478566
  • 37
  • 12

1 Answers1

2
  1. Check internet connectivity because it may be proxy issue.

  2. Remove local maven .m2 reposiotory folder and do mvn clean install again will resolve the issue.

If above solutions don't work then attach the pom.xml file in the question.

Alien
  • 15,141
  • 6
  • 37
  • 57
  • I have attached pom file as you suggested. Thanks, – user10478566 Nov 19 '18 at 12:53
  • did you clear the .m2 repository? if yes then do update maven and check the option "Force update of Snapshots/Releases" in Eclipse. this clears all errors. So right click on project -> Maven -> update project, then check the above option -> Ok. – Alien Nov 19 '18 at 12:57
  • after updating it is showing error in this part of the pom org.springframework.boot spring-boot-starter-parent 2.0.6.RELEASE – user10478566 Nov 19 '18 at 13:21
  • Project build error: Non-resolvable parent POM for com.javaInUse:springBootHelloWorld:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.6.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. – user10478566 Nov 19 '18 at 13:23
  • have you deleted local maven m2 repository and tried to reinstall using mvn clean install? – Alien Nov 19 '18 at 13:23
  • yes i did and even did the update with the check mark"force update snapshots/releases" after okay it is giving me this error – user10478566 Nov 19 '18 at 13:27
  • https://stackoverflow.com/questions/4856307/when-maven-says-resolution-will-not-be-reattempted-until-the-update-interval-of – Alien Nov 19 '18 at 13:29