Search code examples
javaspringspring-tool-suitespring-4

Cannot import org.apache.commons.lang3.math.NumberUtils


My IDE is Spring Tool Suite. I want to use the NumberUtils.isNumber function. STS does not know the class , and there is no suggestion of import in the error icon. My buildpath is using java-se 1.6 :

enter image description here

In pom.xml java-version is 1.7 :

<properties>
    <java-version>1.7</java-version>
    <org.springframework-version>4.0.3.RELEASE</org.springframework-version>
    <org.aspectj-version>1.6.10</org.aspectj-version>
    <org.slf4j-version>1.6.6</org.slf4j-version>
    <jcl.slf4j.version>1.7.12</jcl.slf4j.version>
</properties>

So how to make the import possible ?


Solution

  • Apache libraries doesn't come inbuilt with conventional java libraries. You have to add them. Add this dependency to pom.xml to access that method.

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0</version>
    </dependency>
    

    source