build fails with cannot find symbol StringUtils

LabKey Support Forum
build fails with cannot find symbol StringUtils Will Holtz  2018-03-14 13:16
Status: Closed
 

I have been trying to build r56184 (I think this is the 17.3 release) and it was failing with:

/Users/wholtz/code/labkey/trunk/server/modules/query/src/org/labkey/query/controllers/AbstractExternalSchemaForm.java:18: error: package org.apache.commons.lang does not exist
import org.apache.commons.lang.StringUtils;
                              ^
/Users/wholtz/code/labkey/trunk/server/modules/query/src/org/labkey/query/controllers/AbstractExternalSchemaForm.java:49: error: cannot find symbol
        if (StringUtils.isBlank(bean.getUserSchemaName()))
            ^
  symbol:   variable StringUtils ```

It appears that org.apache.commons:commons-lang changed to org.apache.commons:commons-lang3 and that the dependency on org.apache.commons:commons-lang is no longer declared. 
``` ./gradlew :server:modules:core:dependencies | grep lang ``` only gives command-lang3:3.5 results. I'm pretty clueless about setting up dependencies in gradle, but I edited server/modules/query/build.gradle to include ``` compile group: 'commons-lang', name: 'commons-lang', version: '2.6' ``` within the dependencies block and was then able to get the build to successfully complete. There may be better ways to do this.

I solved my problem but wanted to post here in case someone else hits this or if an improvement needs to be made to the dependencies definitions.

-Will
 
 
Will Holtz responded:  2018-03-14 13:17

Hmm.. My attempt to utilize Markdown for the first time in the forum appears to have been a bust. Sorry about that and ignore those triple ticks.

-Will

 
Susan Hert responded:  2018-03-16 20:06

This was fixed with r56210 in the release17.3 branch, which changed AbstractExternalSchemaForm.java to use commons.lang3.StringUtils instead of commons.lang.StringUtils.

The problem occurred because one of the repositories we were using for getting external dependencies became unavailable, which revealed that we were using the unintended StringUtils class.

Susan