ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doroszlai, Attila (JIRA)" <>
Subject [jira] [Created] (AMBARI-21701) Add check for import from relocated packages
Date Thu, 10 Aug 2017 12:50:00 GMT
Doroszlai, Attila created AMBARI-21701:

             Summary: Add check for import from relocated packages
                 Key: AMBARI-21701
             Project: Ambari
          Issue Type: Improvement
          Components: ambari-server
    Affects Versions: 3.0.0
            Reporter: Doroszlai, Attila
            Assignee: Doroszlai, Attila
            Priority: Minor
             Fix For: 3.0.0

Occasionally an import from {{org.apache.hadoop.metrics2.sink.relocated....}} creeps into
{{ambari-server}} source code, causing compile errors:

$ mvn -am -pl ambari-server clean test
[ERROR] ambari-server/src/test/java/org/apache/ambari/server/checks/[39,71]
package does not exist
[ERROR] ambari-server/src/test/java/org/apache/ambari/server/checks/[114,34]
cannot find symbol
[ERROR]   symbol:   variable Sets
[ERROR]   location: class org.apache.ambari.server.checks.AbstractCheckDescriptorTest

The problem is that the same code can be compiled if dependencies are already installed in
one's local Maven repository.

$ mvn -am -pl ambari-metrics/ambari-metrics-common,ambari-serviceadvisor,ambari-views clean
$ mvn -pl ambari-server clean test

This succeeds because {{ambari-metrics-common}} installs a shaded uber jar including the {{..relocated..}}
packages, hence they are available when compiling {{ambari-server}}.  On the other hand, when
building from scratch (selectively with {{-am -pl ...}}, or the entire multimodule project)
classpath contains {{ambari-metrics-common}} classes and individual dependencies without relocation.

The goal of this change is to add a checkstyle check to catch such imports at build-time with
both compilation methods.

This message was sent by Atlassian JIRA

View raw message