Monday, December 14, 2015

Some MAVEN BUILD Challenges

Today let's go through some of the learnings from maven build failure
Challenge 1)
testSet failed: java.lang.IllegalArgumentException: Language not supported in this application: Lang(en,IN) not in Lang.availables(), took 6.537 sec
[error] at play.mvc.Http$Context.setTransientLang(Http.java:238)
Solution
Make sure OS locale is correct one.
For example in Ubuntu localce can modify by editing the below file
/etc/default/locale

Challenge 2)
phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
Solution
phantomjs say no dependencies but it require fontconfig. Install this missing dependencies by using below command
sudo apt-get install libfontconfig

Challenge 3)
DockerException: Can't obtain ID from build output stream.
Solution
Normally due to network fluctuations it may happens, please retry and see.
Another cause of error is low memory availability for maven, we can set heap memory for maven as below ( would give it 2Gb of heap)
  • set MAVEN_OPTS=-Xmx2048m 
OS Memory leak may also lead unavailability of enough memory, In ubuntu noticed that after running dockers, memory are not released properly, please use below command to verify, in case if available memory is less we may need to consider rebooting of ubuntu as well.
free -m
NOTE: While retry always use the flag -rf, --resume-from
          Resume reactor from specified project
example: mvn <goals> -rf :redis-poc

Challenge 4)
Some of the sanity test cases fails and stuck to proceed with build, and don't want waste time on low priority fixes?
Solution
We can skip test cases by defining the property in pom.xml, say skipITs like below under the corresponding plugin.


<plugin>
  <executions>
    <execution>
        ....
        ....
        <configuration>
            <skip>${skipITs}</skip>
            <executable>.....

And use below build option.
mvn <goals> -DskipTests
example: mvn clean install -DskipTests=true
NOTE:Please do with extra caution, as we don't want to skip any major failures.