ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Padilla <f...@interdimensions.com>
Subject Re: Two issues
Date Sun, 18 Feb 2001 16:30:35 GMT


On possibility is to one source tree, one build tree, then use filesets at
the jar creation.

for example.

<jar jarfile="c1.jar">
 <fileset dir="build">
  <include name="org/ungoverned/c1/**"/>
 </fileset>
</jar>




On Sun, 18 Feb 2001, Richard S. Hall wrote:

> First, I am using Ant 1.3beta2 on Win98 with JDK 1.3.
>
> I was re-organizing my build files this morning and I ran across two
> issues.  I have all of my source files in one package tree, since that
> is how they are logically organized, but portions of the source tree are
> actually packaged into separate JAR files.
>
> For an example, we'll use this directory structure:
>
> src
>    org
>       ungoverned
>          c1
>          c2
>          c3
>
> The packages c1, c2, c3 represent individual components that are
> compiled into separate JAR files containing only the classes from their
> respective package.
>
> Since each one (c1, c2, c3) is created using a very similar target in my
> build file, I use local parameters to parameterize the differences,
> e.g.:
>
>     <target name="c1" depends="blah">
>         <property name="my.name" value="c1"/>
>         <property name="my.output" value="${out$}/${my.name}"/>
>         ... then compile and create JAR file here...
>     </target>
>
> For each component, the above is exactly the same other than the name of
> the component.  (One side note, is there a built-in property for the
> currently executing target?).  An issue arose when I added a dependency
> between two of the components, e.g.:
>
>     <target name="c1" depends="blah,c2">
>         ...
>     </target>
>
> In this scenario, Ant does execute the "c2" target first, but when it
> comes back to execute the "c1" target, the local property ${my.name} is
> bound to the value in "c2", not the value that I set it to in "c1".
> Thus the target doesn't do the right thing since its name property is
> incorrect.  Is this the correct behavior?
>
> In order to work around this issue, I have removed the dependency from
> "c1" and I added a sub-target that builds them in the correct order.  In
> doing so, I did discover another issue.  If I specifically build just
> the "c1" target and the "c2" target has not been created, then Ant
> (actually javac I assume) automatically includes the Java files from the
> "c2" target that "c1" depends on because all of the classes are in the
> same src tree.  The interesting thing is that Ant correctly states that
> is is compiling 14 files (which I counted), but the result from the
> compiler includes classes from the "c2" package.  This doesn't seem like
> the correct behavior from Ant's perspective (from javac perhaps, but not
> Ant).  I would rather get an error saying there were unresolved symbols,
> instead I end up with duplicated classes in multiple JAR files.
>
> Both of these issues are avoidable, but annoying.  Am I doing something
> incorrectly here?
>
> -> richard
>


Mime
View raw message