JUnit 5 introduces a new set of APIs which separates out the launching aspects and the test identification and execution of those tests. As such, the launcher APIs is what the junitlauncher task uses/requires. Test engines on the other hand are pluggable and aren't necessary for the junitlauncher task itself to be functional. Of course, the absence of a test engine implies there won't be any tests that will get run. However, which test engine to use is up to the users to decide and the junitlauncher task itself doesn't need those libraries for itself.

As for the ability to have the JUnit 5 libraries, including the platform launcher API jars, within the classpath element of the junitlauncher task - it's not straightforward to accomplish for reasons noted in[1]. The JUnit task has very complex logic (for valid reasons) to support this specific use case (since 1.7.0 of Ant). So at this point, that's not something that I wanted to attempt or support. One thing however, that I do plan to experiment and probably support in a subsequent release is the ability to have the test engine library jars (and _not_ the JUnit 5 platform launcher API jars) within the classpath element of the junitlauncher task. I had attempted this in the very first version of this task, but ran into certain classloader issues which I did not time to investigate, so decided to push it out for now.

[1] http://ant.apache.org/faq.html#delegating-classloader

-Jaikiran


On 17/03/18 8:39 PM, Gintautas Grigelionis wrote:
Thanks for correcting the omission.

But, the task manual page states that junit.jar of JUnit 4 might still be
necessary
...

For junit-vintage engine:

    - junit-vintage-engine.jar
    - junit.jar (JUnit 4.x version)

...

so perhaps it's worth a note anyway.

I was wondering why junitlauncher task depended on all jars being present
in Ant classpath with no possibility to set a separate classpath for the
task?

Gintas

2018-03-17 15:05 GMT+01:00 Jaikiran Pai <jai.forums2...@gmail.com>:

The change noted in this commit isn't actually needed i.e. the
junitlauncher task doesn't require the junit.jar to be available as noted
in the junitlauncher task's manual.

I however forgot to include the JUnit 5 platform API dependencies in this
Library Dependencies table, which I'll add now.

-Jaikiran


On 17/03/18 7:22 PM, gin...@apache.org wrote:

Repository: ant
Updated Branches:
    refs/heads/master 50b9be737 -> a312b6728


Add dependency description

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/a312b672
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/a312b672
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/a312b672

Branch: refs/heads/master
Commit: a312b6728acb7a8d1f8765899615205b3042cb7e
Parents: 50b9be7
Author: Gintas Grigelionis <gin...@apache.org>
Authored: Sat Mar 17 14:52:06 2018 +0100
Committer: Gintas Grigelionis <gin...@apache.org>
Committed: Sat Mar 17 14:52:06 2018 +0100

----------------------------------------------------------------------
   manual/install.html | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/a312b672/man
ual/install.html
----------------------------------------------------------------------
diff --git a/manual/install.html b/manual/install.html
index 191f3da..cfe9266 100644
--- a/manual/install.html
+++ b/manual/install.html
@@ -787,7 +787,9 @@ these tasks available. Please refer to the <a
href="#optionalTasks">Installing A
     </tr>
     <tr>
       <td>junit.jar</td>
-    <td><a href="Tasks/junit.html">junit</a> task (may be in classpath
passed to task rather than Ant's classpath)</td>
+    <td><a href="Tasks/junit.html">junit</a> task (may be in classpath
passed to task rather than
+      Ant's classpath) and <td><a 
href="Tasks/junitlauncher.html">junitlauncher</a>
task (must be on
+      Ant's classpath)</td>
       <td><a href="https://junit.org/"; target="_top">https://junit.org/
</a></td>
     </tr>
     <tr>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to