开发者

Is there a way to 'test run' an ant build?

开发者 https://www.devze.com 2023-03-14 07:31 出处:网络
Is there a way to run an ant build such that you get an output of what the build开发者_JS百科 would do, but without actually doing it?

Is there a way to run an ant build such that you get an output of what the build开发者_JS百科 would do, but without actually doing it?

That is to say, it would list all of the commands that would be submitted to the system, output the expansion of all filesets, etc.

When I've searched 'ant' and 'test', I get overwhelming hits for running tests with ant. Any suggestions on actually testing ant build files?


It seems, that you are looking for a "dry run".

I googled it a bit and found no evidence that this is supoorted.

Heres a bugzilla-request for that feature, that explains things a bit: https://issues.apache.org/bugzilla/show_bug.cgi?id=35464


This is impossible in theory and in practice. In theory, you cannot test a program meaningfully without actually running it (basically the halting problem).

In practice, since individual ant tasks very often depend on each other's output, this would be quite pointless for the vast majority of Ant scripts. Most of them compile some source code and build JARs from the class files - but what would the fileset for the JAR contain if the compiler didn't actually run?

The proper way to test an Ant script is to run it regularly, but on a test system, possibly a VM image that you can restory to the original state easily.


Here's a problem: You have target #1 that builds a bunch of stuff, then target #2 that copies it.

You run your Ant script in test mode, it pretends to do target #1. Now it comes to target #2 and there's nothing to copy. What should target #2 return? Things can get even more confusing when you have if and unless clauses in your ant targets.

I know that Make has a command line parameter that tells it to run without doing a build, but I never found it all that useful. Maybe that's why Ant doesn't have one.

Ant does have a -k parameter to tell it to keep going if something failed. You might find that useful.


As Michael already said, that's what Test Systems - VM's come in handy- are for

From my ant bookmarks => some years ago some tool called "Virtual Ant" has been announced, i never tried it. So don't regard it as a tip but as something someone heard of

From what the site says =

"With Virtual Ant you no longer have to get your hands dirty with XML to create or edit Ant build scripts. Work in a completely virtualized environment similar to Windows Explorer and run your tasks on a Virtual File System to see what they do, in real time, without affecting your real file system*. The actual Ant build script is generated in the background."

Hm, sounds to good to be true ;-)

..without affecting your real file system.. might be what you asked for !?
They provide a 30day trial license so you won't lose no money but only the time to have a look on..

0

精彩评论

暂无评论...
验证码 换一张
取 消