Maven罐子类冲突

时间:2016-07-20 04:49:16

标签: maven

  1. 我们在项目中使用maven,我们正面临一些问题 罐

    问题是:

    项目中有ss_css2 jar和cssparser jar。这两个人正在 用于不同的功能。

    问题是这两个罐子有相同的包装有相同的包装

    com.steadystate.css.parser.CSSOMParser

  2. 因此我们遇到了冲突。它实际上的地方 需要从cssparser获得CSSOMParser类而不是它     解决ss_css2 jar中的类因为它正在下面     例外

    com.steadystate.css.parser.CSSOMParser.<init>(Lorg/w3c/css/sac/Parser;)V
    java.lang.NoSuchMethodError:
    com.steadystate.css.parser.CSSOMParser.<init>(Lorg/w3c/css/sac/Parser;)V
        at
    com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.parseCSS(CSSStyleSheet.java:882)
        at
    com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.<init>(CSSStyleSheet.java:193)
        at
    com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.loadStylesheet(CSSStyleSheet.java:341)
        at
    com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLinkElement.getSheet(HTMLLinkElement.java:152)
        at
    com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.item(StyleSheetList.java:167)
        at
    com.gargoylesoftware.htmlunit.javascript.host.Window.getComputedStyle(Window.java:1687)
        at
    com.gargoylesoftware.htmlunit.html.DomNode.isDisplayed(DomNode.java:749)
        at
    com.gargoylesoftware.htmlunit.html.HtmlElement.isDisplayed(HtmlElement.java:1319)
        at
    org.openqa.selenium.htmlunit.HtmlUnitWebElement.isDisplayed(HtmlUnitWebElement.java:490)
        at org.openqa.selenium.htmlunit.HtmlUnitWebElement$1.call(
    

    如果我们删除ss_css2 jar其他功能失败,     在进行pdf转换的文本时低于异常

    ERROR core.JobRunShell:211 - Job
    com.scraper.ScheduledAgentLauncher.ScheduledAgent_DMSAgentProcessor_8
    threw an unhandled Exception: 
    org.springframework.scheduling.quartz.JobMethodInvocationFailedException:
    Invocation of method 'run' on target class [class
    com.highradius.dms.scheduler.DMSAgentScheduledAction] failed; nested
    exception is java.lang.NoClassDefFoundError:
    com/steadystate/css/parser/SACParser    at
    org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:273)
        at
    org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)    at
    org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
    Caused by: java.lang.NoClassDefFoundError:
    com/steadystate/css/parser/SACParser    at
    org.zefer.html.doc.css.d.<init>(Unknown Source)     at
    org.zefer.html.doc.css.c.<init>(Unknown Source)     at
    org.zefer.html.doc.css.c.<init>(Unknown Source)
    

    请建议解决此问题的最佳方法是什么。

1 个答案:

答案 0 :(得分:0)

您可以使用maven-dependency-plugin并配置include / exclude参数以包含或排除类。

请参阅Unpacking specific artifacts

希望这会有所帮助。