Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shade latest guava library to sentu sonar plugin #440

Closed
romani opened this issue Mar 10, 2016 · 6 comments

Comments

@romani
Copy link
Member

commented Mar 10, 2016

problem is described at #436

@rdiachenko

This comment has been minimized.

Copy link
Member

commented Jul 1, 2019

Looks like shading has already been introduced in #401. Now we have both, a shading guava and a guava dependency:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.2</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <dependencyReducedPomLocation>
                ${project.build.directory}/dependency-reduced-pom.xml
              </dependencyReducedPomLocation>
              <artifactSet>
                <includes>
                  <include>com.github.sevntu.checkstyle</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google.common</pattern>
                  <shadedPattern>
                    com.puppycrawl.tools.checkstyle.guava
                  </shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>

and

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>15.0</version>
    </dependency>
@romani

This comment has been minimized.

Copy link
Member Author

commented Jul 2, 2019

We probably need to remove shading at all, in recent sonar version it is not a problem. We even removed shading in checkstyle plugin completely.
checkstyle/sonar-checkstyle#214

@rdiachenko

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

We need to remove both: guava dependency and shading plugin. After explicitly excluding checkstyle dependency from sevntu-sonar plugin (#746) there might be occasional failures due to classpath conflicts between two guavas: one from sevntu-sonar plugin and another from provided checkstyle dependency (which was explicitly excluded).

I've already done testing on few checsktyle versions, need to consolidate the results and prepare a PR with guava and shading plugin removal.

@romani

This comment has been minimized.

Copy link
Member Author

commented Jul 3, 2019

If it works , let's remove them

rdiachenko added a commit to rdiachenko/sevntu.checkstyle that referenced this issue Jul 3, 2019

@rdiachenko

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

Regularly reproduced with the following configuration:

  • sonarqube 7.5
  • checkstyle sonar plugin 4.17 (checkstyle 8.17)

Exception during sonar analysis:

$ mvn sonar:sonar -Dsonar.host.url=http://localhost:9000/ -X
...
Exception in thread "main" java.lang.Error: Error was thrown while processing /home/rdiachenko/work/sonar/checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java
	at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:302)
	at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:217)
	at org.sonar.plugins.checkstyle.CheckstyleExecutor.executeWithClassLoader(CheckstyleExecutor.java:111)
	at org.sonar.plugins.checkstyle.CheckstyleExecutor.execute(CheckstyleExecutor.java:85)
	at org.sonar.plugins.checkstyle.CheckstyleSensor.execute(CheckstyleSensor.java:42)
	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:62)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
	at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy27.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)
	at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:104)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.whitespace()Lcom/google/common/base/CharMatcher;
	at com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck.containsForbiddenFragment(SummaryJavadocCheck.java:261)
	at com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck.visitJavadocToken(SummaryJavadocCheck.java:149)
	at com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.walk(AbstractJavadocCheck.java:350)
	at com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.processTree(AbstractJavadocCheck.java:335)
	at com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.visitToken(AbstractJavadocCheck.java:302)
	at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:382)
	at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:489)
	at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:323)
	at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:185)
	at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:81)
	at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:319)
	at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:289)

But works fine for:

  • sonarqube 7.8
  • checkstyle sonar plugin 4.18, 4.19, 4.20 (checkstyle 8.18, 8.19, 8.20)

After removing guava and shade plugin the aforementioned exception stopped reproducing.

@rnveach

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

Fix was merged

@rnveach rnveach closed this Jul 4, 2019

@rnveach rnveach added this to the 1.35.0 milestone Jul 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.