Attila Doroszlai created HDDS-14644:
---------------------------------------

             Summary: Move test-utils code back to src/main
                 Key: HDDS-14644
                 URL: https://issues.apache.org/jira/browse/HDDS-14644
             Project: Apache Ozone
          Issue Type: Task
          Components: build
            Reporter: Attila Doroszlai
            Assignee: Attila Doroszlai


{{hdds-test-utils}} depends on other jars, e.g. {{commons-io}} and 
{{commons-lang}}.  With code in {{src/test}}, these dependencies need to be in 
test scope, e.g.:

{code:title=https://github.com/apache/ozone/blob/922697ec121b206823299101aadc938bec87ece5/hadoop-hdds/test-utils/pom.xml#L70-L74}
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>
{code}

But such dependencies are [not 
transitive|https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope].
  Modules which do not depend on {{commons-io}} will fail to use {{test-utils}}:

{code}
java.lang.NoClassDefFoundError: 
org/apache/commons/io/input/CharSequenceInputStream
        at 
org.apache.ozone.test.GenericTestUtils$LogCapturer.captureLogs(GenericTestUtils.java:247)
{code}

{{hdds-test-utils}} classes should be in {{src/main}}.  Modules should set it 
to {{<scope>test</scope>}}.

For example 
[Hadoop|https://github.com/apache/hadoop/tree/branch-3.4.2/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/]
 and 
[gRPC|https://github.com/grpc/grpc-java/tree/master/testing/src/main/java/io/grpc/testing]
 also have code intended for tests in other projects located in {{src/main}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to