3

I am working on a spring boot application. The maven version i use is 3.3.9. In settings.xml i have configured the proxy as well. The maven build is getting SUCCESS in command prompt. But when i try to import the project to eclipse am getting project build error.

Methods i have tried to resolve the error:

  1. used maven->Update maven project (no improvement)
  2. In eclipse i have changed the location of local m2 repository as windows->preferences->maven->user settings and pointed it to C:\apache-maven-3.3.9\conf\settings.xml (no improvement)
  3. Tried executing mvn eclipse:eclipse command. But it failed.
  4. used the command in cmd mvn clean install -U

Contents of the pom

<?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.sample.eig</groupId>
   <artifactId>ols</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>ols</name>
   <description>Spring Boot Project</description>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.0.0.RELEASE</version>
      <relativePath />
   </parent>
   <repositories>
      <repository>
         <id>0</id>
         <name>TMS</name>
         <url>http://archiva.sample.com:10203/archiva/repository/repo</url>
      </repository>
   </repositories>
   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
      <azure.version>0.2.3</azure.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-mail</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-jdbc</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-security</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-lang3</artifactId>
         <version>3.0.1</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
         <groupId>com.sendgrid</groupId>
         <artifactId>sendgrid-java</artifactId>
         <version>4.1.2</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>io.springfox</groupId>
         <artifactId>springfox-swagger2</artifactId>
         <version>2.7.0</version>
      </dependency>
      <dependency>
         <groupId>io.springfox</groupId>
         <artifactId>springfox-swagger-ui</artifactId>
         <version>2.7.0</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-cache</artifactId>
      </dependency>
      <dependency>
         <groupId>net.sf.ehcache</groupId>
         <artifactId>ehcache</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.security.oauth</groupId>
         <artifactId>spring-security-oauth2</artifactId>
         <version>2.3.3.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.security</groupId>
         <artifactId>spring-security-config</artifactId>
      </dependency>
      <dependency>
         <groupId>com.microsoft.sqlserver</groupId>
         <artifactId>sqljdbc4</artifactId>
         <version>4.0</version>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-thymeleaf</artifactId>
      </dependency>
      <dependency>
         <groupId>net.sourceforge.nekohtml</groupId>
         <artifactId>nekohtml</artifactId>
         <version>1.9.21</version>
      </dependency>
      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.1.1</version>
      </dependency>
      <dependency>
         <groupId>com.microsoft.ews-java-api</groupId>
         <artifactId>ews-java-api</artifactId>
         <version>2.0</version>
      </dependency>
      <dependency>
         <groupId>org.jsoup</groupId>
         <artifactId>jsoup</artifactId>
         <version>1.10.2</version>
      </dependency>
   </dependencies>
   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>
</project>

The error log is as follows:

Project build error: Non-resolvable parent POM Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE from http://repo.maven.apache.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of artie has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE from/to artie (http://repo.maven.apache.org/maven2/): NullPointerException and 'parent.relativePath' points at no local POM pom.xml

Shobana VK
  • 359
  • 2
  • 3
  • 10

3 Answers3

1

Check your internet connection and ensure that you are able to access http://repo.maven.apache.org/maven2/ with your browser. If yes, check if you need to configure a proxy server. If no, you should contact your internet provider.

see documentation ,for how to configure a proxy server for Maven:

Also delete the .m2 local Directory and run mvn clean install again

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

Alien
  • 15,141
  • 6
  • 37
  • 57
  • Proxy is configured and the build is getting success. Getting build error only on importing the project to eclipse. – Shobana VK Nov 26 '18 at 08:13
  • Right click on the project --> Maven --> Update project. refer https://stackoverflow.com/questions/11030422/successful-build-in-maven-still-showing-errors-in-eclipse – Alien Nov 26 '18 at 08:34
0

It worked for me after deleting the .m2 local Directory and then run mvn clean install again.

Vaibhav Sharma
  • 1,573
  • 2
  • 19
  • 35
Bala
  • 1
0

I have noticed that the windows system user did not have privileges to create the folders .m2 or any other folder in c:\users\user folder. So I elevated the privileges of the system user as admin and it all worked fine.