[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539414#comment-16539414 ] ASF GitHub Bot commented on NIFI-5289: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2780 > 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 >Reporter: Martin Payne >Priority: Minor > Fix For: 1.8.0 > > > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539413#comment-16539413 ] ASF subversion and git services commented on NIFI-5289: --- Commit eaef91fabb0eb9bcead624fe60d312b47be70451 in nifi's branch refs/heads/master from [~mapayne] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=eaef91f ] NIFI-5289 - Changed nifi-mock junit Dependency Scope Resolves NoClassDefFoundError for org.junit.Assert when using nifi-mock. Signed-off-by: Matthew Burgess This closes #2780 > 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 >Reporter: Martin Payne >Priority: Minor > Fix For: 1.8.0 > > > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539412#comment-16539412 ] ASF GitHub Bot commented on NIFI-5289: -- Github user mattyb149 commented on the issue: https://github.com/apache/nifi/pull/2780 +1 LGTM (thanks for the reviews and comments!), I ran a full build and verified that no junit JARs are present anywhere in the NiFi assembly. Thanks for the improvement! Merging to master > 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 >Reporter: Martin Payne >Priority: Minor > Fix For: 1.8.0 > > > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16537176#comment-16537176 ] ASF GitHub Bot commented on NIFI-5289: -- Github user joewitt commented on the issue: https://github.com/apache/nifi/pull/2780 it should be fine for junit dep to be compile scope for nifi-mock. nifi-mock will always be used under test scope so the transitive compile scoped deps will be ok. > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16536548#comment-16536548 ] ASF GitHub Bot commented on NIFI-5289: -- Github user MartinPayne commented on the issue: https://github.com/apache/nifi/pull/2780 > The global declaration for JUnit is JUnit 4.12. If someone is using v5, they'll have to work around that. Yes, we're using a workaround at the moment. We have to declare JUnit 4 as a dependency with "test" scope, and configure the Maven Dependency Plugin to force JUnit 4 as used to prevent it from being reported as a declared and unused dependency. I would prefer to have the fix upstream so that we can remove the workaround. > nifi-mock is designed to support JUnit tests and I'm not aware of any components that use JUnit 5. I am using JUnit 5, and I imagine over time many other people will be migrating to it too. Code wise there is nothing in nifi-mock which means it shouldn't work with JUnit 5, and I would expect it to work with other test frameworks too. I've provided a link to a table of Maven dependency scopes to demonstrate that this won't result in JUnit ending up in non-test code. Are there any further concerns about this fix? > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16536436#comment-16536436 ] ASF GitHub Bot commented on NIFI-5289: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2780 > (it won't be on the test classpath if you're using JUnit 5) The global declaration for JUnit is JUnit 4.12. If someone > It should be "compile" scope, because nifi-mock is making use of JUnit assertions in non-test code. nifi-mock is designed to support JUnit tests and I'm not aware of any components that use JUnit 5. > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16536419#comment-16536419 ] ASF GitHub Bot commented on NIFI-5289: -- Github user MartinPayne commented on the issue: https://github.com/apache/nifi/pull/2780 @MikeThomsen I'm not too sure what you mean. At the moment you'll get a NoClassDefFoundError unless JUnit 4 happens to be on the test classpath (it won't be on the test classpath if you're using JUnit 5). That's because nifi-mock declares JUnit 4 with a "provided" scope, when there is nothing providing JUnit 4. It should be "compile" scope, because nifi-mock is making use of JUnit assertions in non-test code. > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16509210#comment-16509210 ] Martin Payne commented on NIFI-5289: [~mike.thomsen] I was writing some tests for a custom processor. We use JUnit 5, so JUnit 4 was not on the test classpath. I would expect the same behaviour with other test frameworks which aren't JUnit 4 too. > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16507940#comment-16507940 ] ASF GitHub Bot commented on NIFI-5289: -- Github user joewitt commented on the issue: https://github.com/apache/nifi/pull/2780 we need to ensure this change doesnt make this lib get included all over the place as part of the build. I dont understand why it should not have been test but compile seems wrong.. > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16507905#comment-16507905 ] Mike Thomsen commented on NIFI-5289: What were you trying to do that was impacted by this? > 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)
[jira] [Commented] (NIFI-5289) NoClassDefFoundError for org.junit.Assert When Using nifi-mock
[ https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16507479#comment-16507479 ] ASF GitHub Bot commented on NIFI-5289: -- GitHub user MartinPayne opened a pull request: https://github.com/apache/nifi/pull/2780 NIFI-5289 - Changed nifi-mock junit Dependency to Compile Scope Resolves NoClassDefFoundError for org.junit.Assert when using nifi-mock. Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/MartinPayne/nifi upstream/pr/mock-junit-dependency Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2780.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2780 commit 9e43ef9a188f5afc717cb505a33b464ddaf43755 Author: Martin Payne Date: 2018-06-10T18:48:57Z Changed nifi-mock junit Dependency to Compile Scope Resolves NoClassDefFoundError for org.junit.Assert when using nifi-mock. > 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)