pmd/pmd-eclipse-plugin

Conflict with Jaspersoft Studio plugin (log4j)

rdicroce opened this issue · 0 comments

The latest version of the PMD plugin breaks the Jaspersoft Studio plugin.

Steps to reproduce:

  1. Grab a fresh copy of Eclipse 2020-09.
  2. Install the PMD plugin.
  3. Install the Jaspersoft Studio plugin from the Eclipse Marketplace.

Eclipse will take a LONG time to start after step 3, but it will get there eventually. After it does, open the Error Log and you'll see a bunch of "FrameworkEvent ERROR" messages with descriptions like this:

org.osgi.framework.BundleException: Could not resolve module: com.jaspersoft.studio.book [22]
  Unresolved requirement: Require-Bundle: com.jaspersoft.studio; bundle-version="6.14.0"; visibility:="reexport"
    -> Bundle-SymbolicName: com.jaspersoft.studio; bundle-version="6.14.0.final"; singleton:="true"
       com.jaspersoft.studio [20]
         No resolution report for the bundle.  Bundle was not resolved because of a uses constraint violation.
  org.apache.felix.resolver.reason.ReasonException: Uses constraint violation. Unable to resolve resource com.jaspersoft.studio.book [osgi.identity; osgi.identity="com.jaspersoft.studio.book"; type="osgi.bundle"; version:Version="6.14.0.final"; singleton:="true"] because it is exposed to package 'org.apache.log4j' from resources org.apache.log4j [osgi.identity; osgi.identity="org.apache.log4j"; type="osgi.bundle"; version:Version="1.2.15.v201012070815"] and org.slf4j.log4j [osgi.identity; osgi.identity="org.slf4j.log4j"; type="osgi.bundle"; version:Version="1.7.2.v20130115-1340"] via two dependency chains.

Chain 1:
  com.jaspersoft.studio.book [osgi.identity; osgi.identity="com.jaspersoft.studio.book"; type="osgi.bundle"; version:Version="6.14.0.final"; singleton:="true"]
    require: (&(osgi.wiring.bundle=com.jaspersoft.studio)(bundle-version>=6.14.0))
     |
    provide: osgi.wiring.bundle: com.jaspersoft.studio
  org.apache.log4j [osgi.identity; osgi.identity="org.apache.log4j"; type="osgi.bundle"; version:Version="1.2.15.v201012070815"]

Chain 2:
  com.jaspersoft.studio.book [osgi.identity; osgi.identity="com.jaspersoft.studio.book"; type="osgi.bundle"; version:Version="6.14.0.final"; singleton:="true"]
    require: (&(osgi.wiring.bundle=com.jaspersoft.studio)(bundle-version>=6.14.0))
     |
    provide: osgi.wiring.bundle; bundle-version:Version="6.14.0.final"; osgi.wiring.bundle="com.jaspersoft.studio"; singleton:="true"
  org.apache.commons.logging [osgi.identity; osgi.identity="org.apache.commons.logging"; type="osgi.bundle"; version:Version="1.2.0.v20180409-1502"]
    import: (osgi.wiring.package=org.apache.log4j)
     |
    export: osgi.wiring.package: org.apache.log4j
  org.slf4j.log4j [osgi.identity; osgi.identity="org.slf4j.log4j"; type="osgi.bundle"; version:Version="1.7.2.v20130115-1340"]
	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845)
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1779)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

I don't know anything about OSGi so I don't know which plugin is "at fault" here or how to fix this. But I noticed that the dependency from PMD to org.slf4j.log4j was added in 4.10, so I tried downgrading the PMD plugin to 4.9 and that "fixes" the problem.