You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by minifish <ka...@hotmail.com> on 2008/11/25 19:41:12 UTC
Apache Ant add property file and policy file
Hello,
I'm new to Ant. and I'm try to include two files, console.property and
java.policy to my Ant build.xml. Couldn't find much information online, any
suggestions will be great help.
Thank you,
code:
<project name="Tool" basedir="." default="main">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="Tool"/>
<property name="lib.dir" value="lib"/>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar"
basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>
--
View this message in context: http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20687220.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Apache Ant add property file and policy file
Posted by "Scot P. Floess" <sf...@nc.rr.com>.
I know the jar task has an includes attribute...
My guess is these files are someplace outside ${classes.dir} ???
If so, I think you will have to use the includes attribute...
On Tue, 25 Nov 2008, minifish wrote:
>
> any idea how I can include them in my jar file?
>
>
> Scot P. Floess-2 wrote:
>>
>>
>> I assume based on the file names you are wanting to include these files as
>> property files...
>>
>> If so..
>>
>> <property file = "console.property"/>
>> <property file = "java.policy"/>
>>
>>
>> On Tue, 25 Nov 2008, minifish wrote:
>>
>>>
>>> Hello,
>>> I'm new to Ant. and I'm try to include two files, console.property and
>>> java.policy to my Ant build.xml. Couldn't find much information online,
>>> any
>>> suggestions will be great help.
>>> Thank you,
>>>
>>> code:
>>>
>>> <project name="Tool" basedir="." default="main">
>>>
>>> <property name="src.dir" value="src"/>
>>>
>>> <property name="build.dir" value="build"/>
>>> <property name="classes.dir" value="${build.dir}/classes"/>
>>> <property name="jar.dir" value="${build.dir}/jar"/>
>>>
>>> <property name="main-class" value="Tool"/>
>>>
>>> <property name="lib.dir" value="lib"/>
>>>
>>> <path id="classpath">
>>> <fileset dir="${lib.dir}" includes="**/*.jar"/>
>>> </path>
>>>
>>>
>>>
>>> <target name="clean">
>>> <delete dir="${build.dir}"/>
>>> </target>
>>>
>>> <target name="compile">
>>> <mkdir dir="${classes.dir}"/>
>>> <javac srcdir="${src.dir}" destdir="${classes.dir}"
>>> classpathref="classpath"/>
>>> </target>
>>>
>>>
>>> <target name="jar" depends="compile">
>>> <mkdir dir="${jar.dir}"/>
>>> <jar destfile="${jar.dir}/${ant.project.name}.jar"
>>> basedir="${classes.dir}">
>>> <manifest>
>>> <attribute name="Main-Class" value="${main-class}"/>
>>> </manifest>
>>> </jar>
>>> </target>
>>>
>>> <target name="run" depends="jar">
>>> <java fork="true" classname="${main-class}">
>>> <classpath>
>>> <path refid="classpath"/>
>>> <path location="${jar.dir}/${ant.project.name}.jar"/>
>>> </classpath>
>>> </java>
>>> </target>
>>>
>>>
>>>
>>> <target name="clean-build" depends="clean,jar"/>
>>>
>>> <target name="main" depends="clean,run"/>
>>>
>>> </project>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20687220.html
>>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>
>> Scot P. Floess
>> 27 Lake Royale
>> Louisburg, NC 27549
>>
>> 252-478-8087 (Home)
>> 919-754-4592 (Work)
>>
>> Chief Architect JPlate http://sourceforge.net/projects/jplate
>> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>>
>> Architect Keros http://sourceforge.net/projects/keros
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20688372.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Apache Ant add property file and policy file
Posted by minifish <ka...@hotmail.com>.
any idea how I can include them in my jar file?
Scot P. Floess-2 wrote:
>
>
> I assume based on the file names you are wanting to include these files as
> property files...
>
> If so..
>
> <property file = "console.property"/>
> <property file = "java.policy"/>
>
>
> On Tue, 25 Nov 2008, minifish wrote:
>
>>
>> Hello,
>> I'm new to Ant. and I'm try to include two files, console.property and
>> java.policy to my Ant build.xml. Couldn't find much information online,
>> any
>> suggestions will be great help.
>> Thank you,
>>
>> code:
>>
>> <project name="Tool" basedir="." default="main">
>>
>> <property name="src.dir" value="src"/>
>>
>> <property name="build.dir" value="build"/>
>> <property name="classes.dir" value="${build.dir}/classes"/>
>> <property name="jar.dir" value="${build.dir}/jar"/>
>>
>> <property name="main-class" value="Tool"/>
>>
>> <property name="lib.dir" value="lib"/>
>>
>> <path id="classpath">
>> <fileset dir="${lib.dir}" includes="**/*.jar"/>
>> </path>
>>
>>
>>
>> <target name="clean">
>> <delete dir="${build.dir}"/>
>> </target>
>>
>> <target name="compile">
>> <mkdir dir="${classes.dir}"/>
>> <javac srcdir="${src.dir}" destdir="${classes.dir}"
>> classpathref="classpath"/>
>> </target>
>>
>>
>> <target name="jar" depends="compile">
>> <mkdir dir="${jar.dir}"/>
>> <jar destfile="${jar.dir}/${ant.project.name}.jar"
>> basedir="${classes.dir}">
>> <manifest>
>> <attribute name="Main-Class" value="${main-class}"/>
>> </manifest>
>> </jar>
>> </target>
>>
>> <target name="run" depends="jar">
>> <java fork="true" classname="${main-class}">
>> <classpath>
>> <path refid="classpath"/>
>> <path location="${jar.dir}/${ant.project.name}.jar"/>
>> </classpath>
>> </java>
>> </target>
>>
>>
>>
>> <target name="clean-build" depends="clean,jar"/>
>>
>> <target name="main" depends="clean,run"/>
>>
>> </project>
>> --
>> View this message in context:
>> http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20687220.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC 27549
>
> 252-478-8087 (Home)
> 919-754-4592 (Work)
>
> Chief Architect JPlate http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>
> Architect Keros http://sourceforge.net/projects/keros
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20688372.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Apache Ant add property file and policy file
Posted by "Scot P. Floess" <sf...@nc.rr.com>.
I assume based on the file names you are wanting to include these files as
property files...
If so..
<property file = "console.property"/>
<property file = "java.policy"/>
On Tue, 25 Nov 2008, minifish wrote:
>
> Hello,
> I'm new to Ant. and I'm try to include two files, console.property and
> java.policy to my Ant build.xml. Couldn't find much information online, any
> suggestions will be great help.
> Thank you,
>
> code:
>
> <project name="Tool" basedir="." default="main">
>
> <property name="src.dir" value="src"/>
>
> <property name="build.dir" value="build"/>
> <property name="classes.dir" value="${build.dir}/classes"/>
> <property name="jar.dir" value="${build.dir}/jar"/>
>
> <property name="main-class" value="Tool"/>
>
> <property name="lib.dir" value="lib"/>
>
> <path id="classpath">
> <fileset dir="${lib.dir}" includes="**/*.jar"/>
> </path>
>
>
>
> <target name="clean">
> <delete dir="${build.dir}"/>
> </target>
>
> <target name="compile">
> <mkdir dir="${classes.dir}"/>
> <javac srcdir="${src.dir}" destdir="${classes.dir}"
> classpathref="classpath"/>
> </target>
>
>
> <target name="jar" depends="compile">
> <mkdir dir="${jar.dir}"/>
> <jar destfile="${jar.dir}/${ant.project.name}.jar"
> basedir="${classes.dir}">
> <manifest>
> <attribute name="Main-Class" value="${main-class}"/>
> </manifest>
> </jar>
> </target>
>
> <target name="run" depends="jar">
> <java fork="true" classname="${main-class}">
> <classpath>
> <path refid="classpath"/>
> <path location="${jar.dir}/${ant.project.name}.jar"/>
> </classpath>
> </java>
> </target>
>
>
>
> <target name="clean-build" depends="clean,jar"/>
>
> <target name="main" depends="clean,run"/>
>
> </project>
> --
> View this message in context: http://www.nabble.com/Apache-Ant-add-property-file-and-policy-file-tp20687220p20687220.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org