[ 
https://issues.apache.org/jira/browse/HDDS-12460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18057695#comment-18057695
 ] 

Attila Doroszlai commented on HDDS-12460:
-----------------------------------------

[~szetszwo], {{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}

On second thought I think {{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}}.

> test-util code should be moved to src/test
> ------------------------------------------
>
>                 Key: HDDS-12460
>                 URL: https://issues.apache.org/jira/browse/HDDS-12460
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: test
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.0.0
>
>
> Currently, the test-util classes are in src/main.  They should be moved to 
> src/test.



--
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