[GitHub] nifi issue #2780: NIFI-5289 - Changed nifi-mock junit Dependency to Compile ...
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? ---
[GitHub] nifi issue #2780: NIFI-5289 - Changed nifi-mock junit Dependency to Compile ...
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. ---
[GitHub] nifi-maven pull request #5: NIFI-5304 - Changed Lifecycle Phase Binding for ...
GitHub user MartinPayne opened a pull request: https://github.com/apache/nifi-maven/pull/5 NIFI-5304 - Changed Lifecycle Phase Binding for Help Mojo Moved Maven Plugin Plugin help Mojo from "process-classes" to "generate-sources" lifecycle phase to ensure the help Mojo is included in the built plugin. You can merge this pull request into a Git repository by running: $ git pull https://github.com/MartinPayne/nifi-maven upstream/pr/help-mojo Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi-maven/pull/5.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 #5 commit 39aca9c4360b347d5f2e7075dd9162b96d7869c5 Author: Martin Payne Date: 2018-06-13T05:48:53Z NIFI-5304 - Changed Lifecycle Phase Binding for Help Mojo Moved Maven Plugin Plugin help Mojo from "process-classes" to "generate-sources" lifecycle phase to ensure the help Mojo is included in the built plugin. ---
[GitHub] nifi issue #2780: NIFI-5289 - Changed nifi-mock junit Dependency to Compile ...
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. ---
[GitHub] nifi pull request #2780: NIFI-5289 - Changed nifi-mock junit Dependency to C...
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. ---