JetBrains / TeamCity.SonarQubePlugin

A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI
Apache License 2.0
53 stars 32 forks source link

Plugin packaging is failing #76

Closed axel3rd closed 4 years ago

axel3rd commented 4 years ago

Currently from master, a mvn install tc-sdk:start doesn't provide the SonarQube runner.

The sonar-plugin-server\target\sonar-plugin-server-1.0-SNAPSHOT.jar does not contain JSP.

It seems due to Exclude servers from project in pom.xml to avoid indexing :

      <resources>
          <resource>
              <directory>servers/</directory>
              <excludes>
                  <exclude>*</exclude>
              </excludes>
          </resource>
      </resources>

This resources directory tag is propaged into modules and this directory is not existing => src/test/resources (including JSP for server, ...) is skipped.

axel3rd commented 4 years ago

Problem could be seen on last sonar-plugin.zip of Develop build.

axel3rd commented 4 years ago

In addition, Update URL schemas from http to https seems have impact on plugin loading ...

Environment: teamcity-sdk-maven-plugin with TeamCity v2019.2.


Server side

Error:

org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 40; cvc-elt.1: Cannot find the declaration of element 'beans'

Reproducible with a unit test like:

public class PluginServerLoadTest {

    @Test
    public void testSpringLoad() {
        try (ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/META-INF/build-server-plugin-sonar-plugin.xml")) {
            // TeamCity Spring server context is not loaded => will fail due to dependencies
        } catch (Exception e) {
            Assert.assertTrue(
                    e.getMessage().contains("No qualifying bean of type 'jetbrains.buildServer.web.openapi.WebControllerManager' available"),
                    e.getMessage());
        }
    }
}

Agent side

Error message:

WARN - gentUnpackingPluginJarSearcher - Failed to unpack plugin: "C:\Users\somewhere\TeamCity.SonarQubePlugin\servers\2019.2\buildAgent\plugins\sonar-plugin-agent.zip": jetbrains.buildServer.agent.plugins.files.PluginUnpackException: Failed to parse teamcity-plugin.xml from plugin: C:\Users\somewhere\TeamCity.SonarQubePlugin\servers\2019.2\buildAgent\plugins\sonar-plugin-agent.zip. Failed to parse plugin descriptor. Error on line 18: cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'teamcity-agent-plugin'.
Linfar commented 4 years ago

Seems I haven't integrated the fix to masted/develop branches, sorry

axel3rd commented 4 years ago

Seems I haven't integrated the fix to masted/develop branches, sorry

I have fix (mainly revert in fact) that on #77. I can do separate commit if necessary. But I didn't found root cause of these fix, to have serious reflection about sustainable change (the revert is probably a poor solution).