Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-18398

Prevent AvroRecord*.class from being included non-test jar

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.3, 3.3.4
    • 3.3.5
    • common

    Description

      [WARNING] Rule 1: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
      Duplicate classes found:
      
      Found in:
      org.apache.hadoop:hadoop-client-minicluster:jar:3.3.4:compile
      org.apache.hadoop:hadoop-client-api:jar:3.3.4:compile
      Duplicate classes:
      org/apache/hadoop/io/serializer/avro/AvroRecord.class
      org/apache/hadoop/io/serializer/avro/AvroRecord$Builder.class
      org/apache/hadoop/io/serializer/avro/AvroRecord$1.class
      
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce (enforce-banned-dependencies) on project hadoop-client-check-test-invariants: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1] 
      

      When building Hadoop, AvroRecord*.class are included in hadoop-client-api jar and I think it is wrong.
      It is caused by "protobuf-maven-plugin" as a side effect.

      https://github.com/apache/hadoop/blob/rel/release-3.3.4/hadoop-common-project/hadoop-common/pom.xml#L1118

                    <execution>
                      <id>src-test-compile-protoc-legacy</id>
                      <phase>generate-test-sources</phase>
                      <goals>
                        <goal>compile</goal>
                      </goals>
                      <configuration>
                        <skip>false</skip>
                        <!--Generating with old protobuf version for backward compatibility-->
                        <protocArtifact>
                          com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
                        </protocArtifact>
                        <includeDependenciesInDescriptorSet>false</includeDependenciesInDescriptorSet>
                        <protoSourceRoot>${basedir}/src/test/proto</protoSourceRoot>
                        <outputDirectory>${project.build.directory}/generated-test-sources/java</outputDirectory>
                        <clearOutputDirectory>false</clearOutputDirectory>
                        <includes>
                          <include>test_legacy.proto</include>
                          <include>test_rpc_service_legacy.proto</include>
                        </includes>
                      </configuration>
                    </execution>
      

      "src-test-compile-protoc-legacy" 's goal is written "compile" wrongly. It makes outputDirectory (${project.build.directory}/generated-test-sources/java) to be added to "compileSourceRoots" of maven-compiler-plugin.
      "src-test-compile-protoc-legacy" 's goal should be "test-compile".

      Attachments

        Issue Links

          Activity

            People

              eub YUBI LEE
              eub YUBI LEE
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: