The build.xml has a test and a build target. The test target obviously depends on the build target.
How can I run the test target only, temporarily skipping the compilation, without modifying the build.xml file ?
I'm asking because the compilation is too long, and kept up-to-date by a continuous integration server ; and I'm chasing after an issue with the unit tests.
Based upon this description, the dependencies between components can be illustrated as follows: These projects are contained in sibling directories underneath a top level “ example ” directory. The standard way to build a component from Ant is to declare a build or compile target and use the javac task.
The simple way to avoid executing the target is to set the "unless" attribute of the target to the name of some property. If you then set this property on the command line when running Ant, it will bypass that target.
It can be omitted if Maven Ant Tasks was installed in Ant's lib directory. (since 2.0.8) For each dependency resolved using either inline declaration or a pom reference, the property groupId:artifactId:type [:classifier] is defined pointing to the corresponding file. For example, a resolved dependency on junit can be accessed in the following way:
The standard way to build a component from Ant is to declare a build or compile target and use the javac task. Other targets can build a distributable or clean up generated files. For example: Traditionally, a script similar to the example above would have been copied into each of the component directories.
Use the unless
attribute.
<target name="test" unless="dont.run.tests">
If you don't want "test" to run, just
ant -Ddont.run.tests=true
It should be undefined if you want the tests to run. Ant just checks for whether it's defined at all. Also, there's an if
attribute that does the converse.
Here's an article on the both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With