Skip to content

Remove ConsoleLauncher configuration in Ant starter (#98) #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions junit5-jupiter-starter-ant/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Set constants.
#
junit_platform_version='1.5.2'
junit_jupiter_version='5.5.2'
ant_version='1.10.7'
ant_folder="apache-ant-${ant_version}"
ant_archive="${ant_folder}-bin.tar.gz"
Expand All @@ -15,9 +16,16 @@ curl --remote-name "https://archive.apache.org/dist/ant/binaries/${ant_archive}"
tar --extract -z --exclude "${ant_folder}/manual" --file "${ant_archive}"

#
# Load and store junit-platform-console-standalone jar into ${ANT_HOME}/lib.
# Load and store necessary JUnit5 jar into ${ANT_HOME}/lib.
#
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/${junit_platform_version}/junit-platform-console-standalone-${junit_platform_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/platform/junit-platform-commons/${junit_platform_version}/junit-platform-commons-${junit_platform_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/platform/junit-platform-engine/${junit_platform_version}/junit-platform-engine-${junit_platform_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/platform/junit-platform-launcher/${junit_platform_version}/junit-platform-launcher-${junit_platform_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/${junit_jupiter_version}/junit-jupiter-api-${junit_jupiter_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/${junit_jupiter_version}/junit-jupiter-engine-${junit_jupiter_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/${junit_jupiter_version}/junit-jupiter-params-${junit_jupiter_version}.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar")
(cd "${ant_folder}/lib" && curl --remote-name "http://central.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to use Apache Ivy to retrieve the necessary dependencies instead of handling that manually with curl?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about supporting Ivy when supporting Ant-wrapper at #66 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping junit-platform-console-standalone JAR here? Does it no longer work with the <junitlauncher> task?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about supporting Ivy when supporting Ant-wrapper at #66 ?

Does the Ant-wrapper make it somehow easier to use Ivy?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping junit-platform-console-standalone JAR here? Does it no longer work with the <junitlauncher> task?

Ant allows testing to be launched, so junit-platform-console-standalone is not required.
https://ant.apache.org/manual/Tasks/junitlauncher.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about supporting Ivy when supporting Ant-wrapper at #66 ?

Does the Ant-wrapper make it somehow easier to use Ivy?

I don't know much the Ant-wrapper. Is it better to use ivy directly?

Copy link
Member

@sbrannen sbrannen Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it's always better to use Ant with Ivy, since Ivy provides dependency management similar to that provided by Maven or Gradle.

From the documentation for the Ant-wrapper, it appears that that's easier to set up if you're already using Ivy.

So maybe we should actually take the following steps.

  1. Use Ivy in the Ant examples.
  2. Use the Ant-wrapper in the Ant examples.
  3. Use the junitlauncher task in the Ant examples.

Thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sounds good! but what does mean No.3? I already use this one fb685f4#diff-72ebd09ba035959b381f450ac03a68efR37

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that we should ideally follow those steps.

But... if we mix up the order a bit and still arrive at the same outcome, that works, too. 😉


#
# Finally, let Ant do its work...
Expand Down
18 changes: 1 addition & 17 deletions junit5-jupiter-starter-ant/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</target>

<!-- https://junit.org/junit5/docs/snapshot/user-guide/#running-tests-build-ant -->
<target name="test.junit.launcher" depends="compile">
<target name="test" depends="compile">
<junitlauncher haltOnFailure="true" printSummary="true">
<classpath refid="test.classpath"/>
<testclasses outputdir="build/test-report">
Expand All @@ -46,20 +46,4 @@
</junitlauncher>
</target>

<!-- https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher -->
<target name="test.console.launcher" depends="compile">
<java classpathref="test.classpath" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true">
<arg value="--scan-classpath"/>
<arg line="--reports-dir build/test-report"/>
</java>
<junitreport todir="build/test-report">
<fileset dir="build/test-report">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="build/test-report/html"/>
</junitreport>
</target>

<target name="test" depends="test.junit.launcher, test.console.launcher" />

</project>