You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joel Rees <jo...@alpsgiken.gr.jp> on 2002/04/08 12:33:29 UTC

always recompiles

Okay, I read that a directory structure that does not match the package name
will cause re-compiles. Are there other reasons?

Can anyway tell me what my incorrect assumptions were, or at any rate, how I
can get this thing to quit compiling every time?

Here is my package name:

jp.gr.alpsgiken.myclass.dbdriver

And here is the directory structure:

WEB-INF\src\jp\gr\alpsgiken\myclass\dbdriver
WEB-INF\classes\jp\gr\alpsgiken\myclass\dbdriver

and here is my build.xml, which I am keeping in WEB-INF:

<?xml version="1.0" encoding="Shift_JIS" ?>
<project name="myproject" default="dbdriver" basedir="src">

  <property name="src" value="."/>
  <property name="build" value="../classes"/>
  <property name="dbdriver_loc" value="jp/gr/alpsgiken/myclass/dbdriver"/>

  <target name="init">
    <!-- タイムスタンプの生成 -->
    <tstamp/>
    <!-- samples のコンパイルに必要なディレクトリ -->
    <mkdir dir="${build}/${dbdriver_loc}"/>
  </target>

  <target name="dbdriver" depends="init">
    <javac
        srcdir="${src}/${dbdriver_loc}"
        destdir="${build}"
        debug="on"/>
  </target>
</project>

Joel Rees
Alps Giken Kansai Systems Develoment
Suita, Osaka




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


Re: always recompiles

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 9 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
> Stefan Bodewig suggested:
> 
>> On Mon, 8 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
>>
>> >   <property name="src" value="."/>
>> >   <property name="build" value="../classes"/>
>>
>> I'd highly recommend location instead of value here.
>
> Not sure what you mean by location instead of value,

<property name="src"   location="."/>
<property name="build" location="../classes"/>

Ant now knows that you want the properties to point to files and that
it should resolve the file names relative to the project's basedir.
The values of the properties will be absolute pathnames.

Stefan

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


Re: always recompiles

Posted by Joel Rees <jo...@alpsgiken.gr.jp>.
Stefan Bodewig suggested:


> On Mon, 8 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
>
> >   <property name="src" value="."/>
> >   <property name="build" value="../classes"/>
>
> I'd highly recommend location instead of value here.
>
> >     <javac
> >         srcdir="${src}/${dbdriver_loc}"
> >         destdir="${build}"
> >         debug="on"/>
>
> srcdir should be the top of the source tree, which is ${src} in your
> case.

Not sure what you mean by location instead of value, but here's what I did:

<?xml version="1.0" encoding="Shift_JIS" ?>
<project name="My_project" default="rest" basedir="src">

  <!-- set global properties for this build -->
  <property name="src" value="."/>
  <property name="build" value="../classes"/>
  <property name="dbdriver" value="jp/gr/alpsgiken/myclass/dbdriver"/>

  <target name="init">
    <!-- ?????????? -->
    <tstamp/>
    <!-- ??????????????? -->
    <mkdir dir="${build}/${dbdriver}"/>
  </target>

  <target name="dbdriver" depends="init">
    <!-- dbdriver ???????????? ${build} ?????????? -->
    <javac destdir="${build}" debug="on">
        <src path="${src}"/>
        <include name="${dbdriver}/*.java"/>
    </javac>
  </target>

  <target name="rest" depends="dbdriver">
    <!-- ??????????????? ${build} ?????????? -->
    <javac destdir="${build}" debug="on">
        <src path="${src}"/>
        <exclude name="${dbdriver}/**"/>
    </javac>
 </target>

</project>

dbdriver is "package jp.gr.alpsgiken.myclass.dbdriver". I'm in the process
of modularizing the code, and the dbdriver class was the first package to
fall out. This keeps the dependencies straight, and does not cause
unnecessary recompiling. The rest of the packages will fall out in a similar
way.

The exclude element/property was relatively intuitive to me, but include was
a little counter-intuitive, until I caught onto src/srcdir being directories
rather than files. I guess that's what you mean by location instead of
value.

Thanks, and sorry for the noise.

Joel Rees
Alps Giken Kansai Systems Develoment
Suita, Osaka




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


Re: always recompiles

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 8 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:

>   <property name="src" value="."/>
>   <property name="build" value="../classes"/>

I'd highly recommend location instead of value here.

>     <javac
>         srcdir="${src}/${dbdriver_loc}"
>         destdir="${build}"
>         debug="on"/>

srcdir should be the top of the source tree, which is ${src} in your
case.

Stefan

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


Re: always recompiles

Posted by Joel Rees <jo...@alpsgiken.gr.jp>.
Never mind. I found what I had overlooked in the docs. I was misinterpreting
the meaning of the includes property for the javac element. (I hope.)

Joel

----- Original Message -----
From: "Joel Rees" <jo...@alpsgiken.gr.jp>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Monday, April 08, 2002 7:33 PM
Subject: always recompiles


> Okay, I read that a directory structure that does not match the package
name
> will cause re-compiles. Are there other reasons?
>
> Can anyway tell me what my incorrect assumptions were, or at any rate, how
I
> can get this thing to quit compiling every time?
>
> Here is my package name:
>
> jp.gr.alpsgiken.myclass.dbdriver
>
> And here is the directory structure:
>
> WEB-INF\src\jp\gr\alpsgiken\myclass\dbdriver
> WEB-INF\classes\jp\gr\alpsgiken\myclass\dbdriver
>
> and here is my build.xml, which I am keeping in WEB-INF:
>
> <?xml version="1.0" encoding="Shift_JIS" ?>
> <project name="myproject" default="dbdriver" basedir="src">
>
>   <property name="src" value="."/>
>   <property name="build" value="../classes"/>
>   <property name="dbdriver_loc" value="jp/gr/alpsgiken/myclass/dbdriver"/>
>
>   <target name="init">
>     <!-- タイムスタンプの生成 -->
>     <tstamp/>
>     <!-- samples のコンパイルに必要なディレクトリ -->
>     <mkdir dir="${build}/${dbdriver_loc}"/>
>   </target>
>
>   <target name="dbdriver" depends="init">
>     <javac
>         srcdir="${src}/${dbdriver_loc}"
>         destdir="${build}"
>         debug="on"/>
>   </target>
> </project>
>
> Joel Rees
> Alps Giken Kansai Systems Develoment
> Suita, Osaka
>
>
>
>
> --
> 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>


Re: always recompiles

Posted by Adam Murdoch <ad...@apache.org>.
On Mon, 8 Apr 2002 20:33, Joel Rees wrote:

>
>   <target name="dbdriver" depends="init">
>     <javac
>         srcdir="${src}/${dbdriver_loc}"
>         destdir="${build}"
>         debug="on"/>
>   </target>
> </project>
>

Use srcdir="${src}" instead.


-- 
Adam

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