Liferay 6.1 Repair of a huge bug built with maven Service-builder

Source: Internet
Author: User
Tags log

Today, my colleagues need to switch to maven in the Liferay service builder, because Maven 6.1 is already in the archetype, so I thought it was a simple question, and I know it's been hard for me 3 hours.

The previous steps are the same, creating a service-builder archetype, as shown in the following figure:

Then, when you run the command Liferay:build-service, the following problems always occur:

Info: Global Lib directory/c:/users/asus/.m2/repository/com/liferay/portal/portal-service/6.1.0/2012-6-13 22:11:45 Com.liferay.portal.kernel.log.Jdk14LogImpl Info info: Portal Lib directory/c:/users/asus/.m2/repository/com/liferay/ portal/util-java/6.1.0/util-java-6.1.0.jar!/Slf4j:the requested version 1.6.4 by your SLF4J binding are not compatible W ith [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11] Slf4j:see http://www.slf4j.org/codes.html#version_mismatch for F 
Urther details. 
Slf4j:class path contains multiple slf4j bindings. Slf4j:found Binding in [jar:file:/c:/users/asus/.m2/repository/com/liferay/portal/util-java/6.1.0/ Util-java-6.1.0.jar!/org/slf4j/impl/staticloggerbinder.class] Slf4j:found binding in [jar:file:/c:/users/asus/.m2/ 
Repository/org/slf4j/slf4j-log4j12/1.5.11/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/staticloggerbinder.class] 
Slf4j:see http://www.slf4j.org/codes.html#multiple_bindings for a explanation. [INFO]------------------------------------------------------------------------[INFO] build failure [INFO]----------------------------------------------------- -------------------[INFO] Total time:4:05.758s [INFO] finished at:wed June 22:11:45 CST [info] Final Memory:3 m/15m [INFO]------------------------------------------------------------------------[ERROR] Failed to execute goal Com.liferay.maven.plugins:liferay-maven-plugin:6.1.0:build-service (DEFAULT-CLI) on project Mavensb-portlet: Execution Default-cli of goal Com.liferay.maven.plugins:liferay-maven-plugin:6.1.0:build-service Failed:an API Incompatibility is encountered while executing com.liferay.maven.plugins:liferay-maven-plugin:6.1.0:build-service: Java.lang.AbstractMethodError:com.liferay.util.sl4fj.LiferayLoggerAdapter.log (Lorg/slf4j/marker; ljava/lang/string;iljava/lang/string; ljava/lang/throwable;) V

The reason is slf4j, the framework needs 1.6.4 version of the SLF4J, but only the 1.5.X version of the slf4j, I initially thought that the problem is very simple, in our project <dependency> add some <exclusion> The elimination of the lower version of the SLF4J can be, the result no matter what. We also found it on the liferay, but some people encountered the same problem, but there was no solution.

Later, I carefully aftertaste the whole process, in fact, this problem is not as simple as we think, although from the log seems to be a class of Util-java rely on the slf4j version of the 1.5.X, in fact, there is a place to rely on, is Jackrabbit, So we have to make sure that these dependencies are properly configured for him.

So, I thought of going to custom Liferay-maven-plugin, I was in C:\Users\asus\.m2\repository\com\liferay\maven\plugins\liferay-maven-plugin\ The Liferay-maven-plugin-6.1.0.pom is found in the 6.1.0 directory, then all the dependencies are changed, and the old version of SLF4J is removed, and finally, the pom I customized is as follows:

The part I changed consists of 204-212 lines, removing the dependency on the jcl-over-slf4j in the Jackrabbit:

第242-249 line, remove old version of SLF4J

第251-258 line, add a new version of SLF4J

第261-268 line, remove old version of slf4j-log4j

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.