You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Toni Penttinen <to...@tassen.fi> on 2001/12/26 13:54:56 UTC

extending existing java task

Hi,

It would be nice to have recursive directory scan in java tasks e.g. similar than javac has.

Couple of examples how it would look like as task point of view:

<target name="example" depends="something" description="example task">
	<java fork="yes" srcdir="${src.dir}"  includes="**/*.java" failonerror="true" classname="example.Main" output="${example.dir}/example_log.xml">
			<arg line="-x -all"/>
		<classpath refid="class.path"/>	
	</java>
</target>

another example:

<target name="example" depends="something" description="example task">
	<java fork="yes" failonerror="true" classname="example.Main" output="${example.dir}/example.xml">
			<arg value="-x"/>
			<arg value="-all"/>
		<fileset dir="${src.dir}">
			<patternset>
				<include name="**/*.java"/>
			</patternset>
		</fileset>
		<classpath refid="class.path"/>
	</java>
</target>


Java task could also extend MatchingTask like javac does.

Regards,

Toni Penttinen 

Re: extending existing java task

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
I'm pretty sure the consensus is that this is a prime candidate for building
a custom task and will not be implemented into Ant's core anytime soon.

You could use <apply> to call "java" directly if you need this functionality
as a workaround, though.

    Erik


----- Original Message -----
From: "Toni Penttinen" <to...@tassen.fi>
To: <an...@jakarta.apache.org>
Sent: Wednesday, December 26, 2001 7:54 AM
Subject: extending existing java task


> Hi,
>
> It would be nice to have recursive directory scan in java tasks e.g.
similar than javac has.
>
> Couple of examples how it would look like as task point of view:
>
> <target name="example" depends="something" description="example task">
> <java fork="yes" srcdir="${src.dir}"  includes="**/*.java"
failonerror="true" classname="example.Main"
output="${example.dir}/example_log.xml">
> <arg line="-x -all"/>
> <classpath refid="class.path"/>
> </java>
> </target>
>
> another example:
>
> <target name="example" depends="something" description="example task">
> <java fork="yes" failonerror="true" classname="example.Main"
output="${example.dir}/example.xml">
> <arg value="-x"/>
> <arg value="-all"/>
> <fileset dir="${src.dir}">
> <patternset>
> <include name="**/*.java"/>
> </patternset>
> </fileset>
> <classpath refid="class.path"/>
> </java>
> </target>
>
>
> Java task could also extend MatchingTask like javac does.
>
> Regards,
>
> Toni Penttinen
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>