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

ASF GitHub Bot commented on NIFI-5289:
--------------------------------------

Github user MartinPayne commented on the issue:

    https://github.com/apache/nifi/pull/2780
  
    @joewitt Compile scope is the correct scope in this case. If JUnit 4 was 
only used in the tests for NiFi Mock, test scope would be correct. However, the 
[NiFi Mock code uses JUnit 4 as a compile time 
dependency](https://github.com/apache/nifi/blob/f8466cb16d6723ddc3bf5f0e7f8ce8a47d27cbe5/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java#L74),
 so JUnit 4 needs to be brought into consuming projects as a transitive 
dependency.
    
    As per the [Maven dependency scope 
table](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope),
 making it a compile scope dependency means it is added to the test classpath 
of a consuming project if that project declares NiFi Mock with test scope. It 
would only get included all over the place if consuming projects have declared 
NiFi Mock with a compile or runtime scope. If that was the case here, NiFi Mock 
would also be getting included all over the place.


> NoClassDefFoundError for org.junit.Assert When Using nifi-mock
> --------------------------------------------------------------
>
>                 Key: NIFI-5289
>                 URL: https://issues.apache.org/jira/browse/NIFI-5289
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.6.0
>            Reporter: Martin Payne
>            Priority: Minor
>
> When using the NiFi Mock framework but not using JUnit 4, tests fail with a 
> NoClassDefFoundError for org.junit.Assert. This is because nifi-mock sets the 
> scope of junit to "provided", which means it's not pulled into consuming 
> projects as a transitive dependency. It should be set to "compile" so that 
> users don't have to set an explicit JUnit dependency in their projects.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to