You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Gilson Nascimento D Elrei <gi...@cpm.com.br> on 2002/08/26 21:02:33 UTC

I can't to generate the jar file in this sample...

I have the follow directory structure on my C: Drive, with one 1 source file
entitle hello.java :
     work
      |
      |__hello
          |-----build.xml                           << The Ant File
(Build.xml)
          |
          |__ classes 
          |     |
          |     |__org
          |         |
          |         |__varnam
          |-- src
          |    |
          |    |__org
          |         |
          |         |__varnam
          |              |
          |              |__hello.java               <<-- my souce sample
code
          |__jars

Now, i want to compile hello.java, put the class file generated on
Work\Hello\classes\org\varnam and finally generate the jar file from the
previous class file generated and copy it to work\hello\jars directory.
It's simple and i got to compile it and generate the class file
(hello.class),  but the target Jar fail, but i don't receive some error
message. The Ant return a successfull message on dos box with only two
targets concluded (Init and build targets).
Below is my build.xml source file:

<!-- C:\work\hello is my initial basedir -->

<project name="hello" default="build" basedir=".">
	<target name="init">
		<property name="jardir" value="jars"/>
		<property name="Src" value="src"/>
		<property name="Dest" value="classes"/>
	</target>
	<target name="build" depends="init">
		<javac srcdir="${Src}" destdir="${Dest}"
includes="org/varnam/**">
			<classpath>
                                                <pathelement
location="c:\jdk1.3.1_02\jre\lib\rt.jar"/>
				<pathelement location="${Src}"/>
			</classpath>
		</javac>
	</target>
	<target name="jar" depends="build">
                <jar destfile="${jardir}/hello.jar" basedir="${Dest}"
includes="org/varnam/**" />
	</target>
</project>

thanks for any comments.

Gilson

          


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


Re: I can't to generate the jar file in this sample...

Posted by Jacob Kjome <ho...@visi.com>.
Hello Gilson,

You have:

destfile="${jardir}/hello.jar"

it should be:

jarfile="${jardir}/hello.jar"


Jake

Monday, August 26, 2002, 2:02:33 PM, you wrote:

GNDE> I have the follow directory structure on my C: Drive, with one 1 source file
GNDE> entitle hello.java :
GNDE>      work
GNDE>       |
GNDE>       |__hello
GNDE>           |-----build.xml                           << The Ant File
GNDE> (Build.xml)
GNDE>           |
GNDE>           |__ classes 
GNDE>           |     |
GNDE>           |     |__org
GNDE>           |         |
GNDE>           |         |__varnam
GNDE>           |-- src
GNDE>           |    |
GNDE>           |    |__org
GNDE>           |         |
GNDE>           |         |__varnam
GNDE>           |              |
GNDE>           |              |__hello.java               <<-- my souce sample
GNDE> code
GNDE>           |__jars

GNDE> Now, i want to compile hello.java, put the class file generated on
GNDE> Work\Hello\classes\org\varnam and finally generate the jar file from the
GNDE> previous class file generated and copy it to work\hello\jars directory.
GNDE> It's simple and i got to compile it and generate the class file
GNDE> (hello.class),  but the target Jar fail, but i don't receive some error
GNDE> message. The Ant return a successfull message on dos box with only two
GNDE> targets concluded (Init and build targets).
GNDE> Below is my build.xml source file:

GNDE> <!-- C:\work\hello is my initial basedir -->

GNDE> <project name="hello" default="build" basedir=".">
GNDE>         <target name="init">
GNDE>                 <property name="jardir" value="jars"/>
GNDE>                 <property name="Src" value="src"/>
GNDE>                 <property name="Dest" value="classes"/>
GNDE>         </target>
GNDE>         <target name="build" depends="init">
GNDE>                 <javac srcdir="${Src}" destdir="${Dest}"
GNDE> includes="org/varnam/**">
GNDE>                         <classpath>
GNDE>                                                 <pathelement
GNDE> location="c:\jdk1.3.1_02\jre\lib\rt.jar"/>
GNDE>                                 <pathelement location="${Src}"/>
GNDE>                         </classpath>
GNDE>                 </javac>
GNDE>         </target>
GNDE>         <target name="jar" depends="build">
GNDE>                 <jar destfile="${jardir}/hello.jar" basedir="${Dest}"
GNDE> includes="org/varnam/**" />
GNDE>         </target>
GNDE> </project>

GNDE> thanks for any comments.

GNDE> Gilson

          


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



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


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


Re: I can't to generate the jar file in this sample...

Posted by Joyce Li <jl...@dwl.com>.
The jar didn't get built because you never called the <jar> target.  That is why
Ant returns with only two
targets concluded (Init and build targets).

Try

        <target name="build" depends="init, compile, jar"/>

        <target name="compile" depends="init">
                <javac srcdir="${Src}" destdir="${Dest}"
                           includes="org/varnam/**">
                        <classpath>
                             <pathelement
location="c:\jdk1.3.1_02\jre\lib\rt.jar"/>
                              <pathelement location="${Src}"/>
                        </classpath>
                </javac>
        </target>
        <target name="jar" depends="build">
                <jar destfile="${jardir}/hello.jar" basedir="${Dest}"
                        includes="org/varnam/**" />
        </target>
</project>

Joyce

Gilson Nascimento D Elrei wrote:

> I have the follow directory structure on my C: Drive, with one 1 source file
> entitle hello.java :
>      work
>       |
>       |__hello
>           |-----build.xml                           << The Ant File
> (Build.xml)
>           |
>           |__ classes
>           |     |
>           |     |__org
>           |         |
>           |         |__varnam
>           |-- src
>           |    |
>           |    |__org
>           |         |
>           |         |__varnam
>           |              |
>           |              |__hello.java               <<-- my souce sample
> code
>           |__jars
>
> Now, i want to compile hello.java, put the class file generated on
> Work\Hello\classes\org\varnam and finally generate the jar file from the
> previous class file generated and copy it to work\hello\jars directory.
> It's simple and i got to compile it and generate the class file
> (hello.class),  but the target Jar fail, but i don't receive some error
> message. The Ant return a successfull message on dos box with only two
> targets concluded (Init and build targets).
> Below is my build.xml source file:
>
> <!-- C:\work\hello is my initial basedir -->
>
> <project name="hello" default="build" basedir=".">
>         <target name="init">
>                 <property name="jardir" value="jars"/>
>                 <property name="Src" value="src"/>
>                 <property name="Dest" value="classes"/>
>         </target>
>         <target name="build" depends="init">
>                 <javac srcdir="${Src}" destdir="${Dest}"
> includes="org/varnam/**">
>                         <classpath>
>                                                 <pathelement
> location="c:\jdk1.3.1_02\jre\lib\rt.jar"/>
>                                 <pathelement location="${Src}"/>
>                         </classpath>
>                 </javac>
>         </target>
>         <target name="jar" depends="build">
>                 <jar destfile="${jardir}/hello.jar" basedir="${Dest}"
> includes="org/varnam/**" />
>         </target>
> </project>
>
> thanks for any comments.
>
> Gilson
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


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