ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 29986] New: - Recursive dependencies.
Date Thu, 08 Jul 2004 21:36:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29986

Recursive dependencies.

           Summary: Recursive dependencies.
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Build Process
        AssignedTo: dev@ant.apache.org
        ReportedBy: laran@elevasoft.com


To quickly sum up my issue, I have two separate but dependent projects.  These
projects both <import file="../build-master.xml" />.  They both call the jar
target, which depends on compile, which depends on dependencies.  The idea
behind this process is that each project can build the projects that it depends
upon, and that this process can be done recursively down to the foundation
project that depends on no other projects.

The problem is that when projectA calls the dependencies target which uses
subant to call the dependencies target on projectB (which projectA depends upon)
Ant barfs with the following trace:

Start Trace ---
C:\dev\home\dfaFinSys\project\travel_web>ant -v compile
Apache Ant version 1.6.1 compiled on February 12 2004
Buildfile: build.xml
Detected Java version: 1.4 in: C:\j2sdk1.4.2_04\jre
Detected OS: Windows XP
parsing buildfile C:\dev\home\dfaFinSys\project\travel_web\build.xml with URI =
file:///C:/dev/home/dfaFinSys/project/travel_web/build.xml
Project base dir set to: C:\dev\home\dfaFinSys\project\travel_web
 [property] Loading C:\Documents and Settings\Evans\ant.properties
 [property] Unable to find property file: C:\Documents and
Settings\Evans\ant.properties
 [property] Loading C:\dev\home\dfaFinSys\project\travel_web\build.properties
 [property] Loading C:\dev\home\dfaFinSys\project\build-master.properties
Importing file ../build-master.xml from
C:\dev\home\dfaFinSys\project\travel_web\build.xml
parsing buildfile C:\dev\home\dfaFinSys\project\build-master.xml with URI =
file:///C:/dev/home/dfaFinSys/project/build-master.xml
Overriding previous definition of reference to dfa_project.dependencies
 [property] Loading Environment env.
Build sequence for target `compile' is [dependencies, compile]
Complete build sequence is [dependencies, compile, setup-workspace, init, clean,
jar, war, ]

dependencies:
   [subant] calling target jar in build file
C:\dev\home\dfaFinSys\project\travel_web\build.xml
parsing buildfile C:\dev\home\dfaFinSys\project\travel_web\build.xml with URI =
file:///C:/dev/home/dfaFinSys/project/travel_web/build.xml
Project base dir set to: C:\dev\home\dfaFinSys\project\travel_web
 [property] Loading C:\Documents and Settings\Evans\ant.properties
 [property] Unable to find property file: C:\Documents and
Settings\Evans\ant.properties
 [property] Loading C:\dev\home\dfaFinSys\project\travel_web\build.properties
 [property] Loading C:\dev\home\dfaFinSys\project\build-master.properties
Importing file ../build-master.xml from
C:\dev\home\dfaFinSys\project\travel_web\build.xml
parsing buildfile C:\dev\home\dfaFinSys\project\build-master.xml with URI =
file:///C:/dev/home/dfaFinSys/project/build-master.xml
Overriding previous definition of reference to dfa_project.dependencies
 [property] Loading Environment env.
Build sequence for target `jar' is [dependencies, compile, jar]
Complete build sequence is [dependencies, compile, jar, setup-workspace, init,
clean, war, ]

BUILD FAILED
C:\dev\home\dfaFinSys\project\build-master.xml:145: subant task calling a target
that depends on its parent target 'dependencies'.
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:368)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:182)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:112)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

Total time: 1 second
C:\dev\home\dfaFinSys\project\travel_web>
Stop Trace ----

Here's my project directory structure:

projects/
projects/build-master.xml
projects/build-master.properties
projects/apples/build.xml
projects/apples/build.properties
projects/apples/src/
projects/apples/classes/
projects/bananas/build.xml
projects/bananas/build.properties
projects/bananas/src/
projects/bananas/classes/
projects/oranges/build.xml
projects/oranges/build.properties
projects/oranges/src/
projects/oranges/classes/

Each build.xml (project build file) looks like this:

<project name="apples" default="init" basedir=".">
  <patternset id="dfa_project.dependencies">
    <include name="oranges" />
  </patternset>
  <property file="${user.home}/ant.properties" />
  <property file="build.properties" />
  <property file="../build-master.properties" />
  <import file="../build-master.xml" />
</project>

build-master.xml defines all of the targets and sets up things like the build
classpath etc.  All of the projects have some level of dependency on the other
projects.  To handle building the project dependencies I have the following
target in build-master.xml:

  <!-- Build Prerequisite Projects -->
  <target
    name="dependencies">
	<subant
	  target="jar">
	  <dirset dir=".">
	    <patternset
		  id="dfa_project.dependencies" />
	  </dirset>
	</subant>
  </target>

And the compile target looks like this (depends on dependencies target):

  <!-- Default Source Compilation -->
  <target name="compile" depends="dependencies">
    <javac srcdir="${dfa_project.src}" 
      destdir="${dfa_project.compile}">
      <classpath>
        <path refid="libs.build" />
      </classpath>
    </javac>
  </target>

Is there some way to get around this?  Or am I going to have to just duplicate
the bodies of the targets and define targets named "apples-compile, apples-jar,
oranges-compile, oranges-jar" etc.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message