Skip to content
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

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions junit5-jupiter-starter-ant/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ant
apache-ant-*
build
lib

# Ignore Gradle GUI config
gradle-app.setting
Expand Down
6 changes: 3 additions & 3 deletions junit5-jupiter-starter-ant/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Set constants.
#
junit_platform_version='1.5.2'
ivy_version='2.4.0'
ant_version='1.10.7'
ant_folder="apache-ant-${ant_version}"
ant_archive="${ant_folder}-bin.tar.gz"
Expand All @@ -15,9 +15,9 @@ 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 ivy 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/apache/ivy/ivy/${ivy_version}/ivy-${ivy_version}.jar")

#
# Finally, let Ant do its work...
Expand Down
28 changes: 8 additions & 20 deletions junit5-jupiter-starter-ant/build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="junit5-jupiter-starter-ant" default="build" basedir=".">
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="junit5-jupiter-starter-ant" default="build" basedir=".">

<fail message="Ant 1.10.4+ is required!">
<condition>
Expand All @@ -12,7 +12,7 @@
<path id="test.classpath">
<pathelement path="build/test"/>
<pathelement path="build/main"/>
<fileset dir="${ant.home}/lib" includes="*.jar" />
<fileset dir="lib" includes="*.jar" />
</path>

<target name="build" description="clean build" depends="clean, test" />
Expand All @@ -27,13 +27,17 @@
<mkdir dir="build/test-report"/>
</target>

<target name="compile" depends="init">
<target name="ivy-retrieve">
<ivy:retrieve/>
</target>

<target name="compile" depends="init, ivy-retrieve">
<javac destdir="build/main" srcdir="src/main/java" includeantruntime="false"/>
<javac destdir="build/test" classpathref="test.classpath" srcdir="src/test/java" includeantruntime="false"/>
</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 +50,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>
8 changes: 8 additions & 0 deletions junit5-jupiter-starter-ant/ivy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
<info organisation="com.example" module="junit5-jupiter-starter-ant"/>
<dependencies>
<dependency org="org.junit.platform" name="junit-platform-launcher" rev="1.5.2"/>
<dependency org="org.junit.jupiter" name="junit-jupiter" rev="5.5.2"/>
</dependencies>
</ivy-module>