0

I need to use EqualsBuilder in my class, for that I need the jar in my pom I added the following line

   <properties> 
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>            
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId> 
            <artifactId>commons-lang3</artifactId>
            <version>3.6</version>
        </dependency>
     </dependencies>

and my dependency is after the properties tag

and in my java class I tried to import the jar import org.apache.commons.lang3.builder; Eclipse is giving error as well as when I try to run maven

[ERROR] /C:/git_project/cis/ipnd/src/main/java/au/com/internode/domain/AbstractObject.java:[9,32] package org.apache.commons.lang3 does not exist

Basically nothing related to lang comes up as a suggestion when I keep on typing in eclipse after org.apache.commons

Sadia H
  • 115
  • 1
  • 2
  • 10
  • 1
    Where did you add the `` tag? Inside ``? If so, move it. See e.g. [Differences between dependencyManagement and dependencies in Maven](https://stackoverflow.com/q/2619598/5221149). – Andreas Dec 04 '19 at 01:05
  • Did you "Maven > Update Project..." after you modified your pom? Do you see the jar in "Maven Dependencies"? – Elliott Frisch Dec 04 '19 at 01:06
  • As a workaround I had to add this jar, but I need proper solution, how do I get it from Maven – Sadia H Dec 04 '19 at 01:10
  • yes, I did update, I saw the jar – Sadia H Dec 04 '19 at 05:01
  • hi @andreas I have added my code udner tag – Sadia H Dec 04 '19 at 23:17
  • I was asking where the `` tag is. I can already see that you have ``, ``, and `` inside ``, but where in the `pom.xml` did you add ``? – Andreas Dec 05 '19 at 02:00
  • hi @andreas, I have added after tag which comes after tag in pom 1.8 org.springframework.boot spring-boot-starter-web – Sadia H Dec 05 '19 at 05:16
  • @SadiaH How about you *edit* the question and add the information there, for all to see, in a format that's easier to read. – Andreas Dec 05 '19 at 05:26

1 Answers1

0

A snippet from pom.xml looks OK to me. I don't have a vast experience with eclipse but I suggest using the following. In general there are 2 things that can go wrong here

  1. Maven part
  2. Eclipse synchronization part

So to eliminate an issue in step one, run mvn clean compile in command line even without Eclipse. If it ends successfully, the issue is with the seconds part. In this case re-import the pom into eclipse and it should work (maybe there is a "refresh" button there as well).

If the issue is in "1" and the mvn clean compile fails on that import - then please post the whole pom, and probably we'll find a mistake

Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97