Search the web
Sign In
New User? Sign Up
jdepend
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Problems with Ant/JDepend continued   Message List  
Reply | Forward Message #41 of 72 |
Re: [jdepend] Problems with Ant/JDepend continued

The classic way to tackle this in ant is to use the <available> task in the
init target and then only run the jdepend target if the classes are present.
Something like the following in the init target:

<available property="jdepend.present"
classname="com.clarkware.jdepend.JDepend"/>
(guessing at the classname because I don't have an example to hand)

And then the jdepend target gains an extra attribute:

<target name="jdepend" depends="init" if="jdepend.present">
...
</target>


Of course this doesn't guarentee that jdepend will run for everyone, but
should mean that those without jdepend don't get a broken build. Ant 1.6
"antlibs" should be able to be a little more creative but I've not
investigated properly yet.

Hope that helps,

Rob

----- Original Message -----
From: "Robert Saenger" <meinc@...>
To: <jdepend@yahoogroups.com>
Sent: Saturday, November 22, 2003 3:01 PM
Subject: [jdepend] Problems with Ant/JDepend continued


> Hi,
> I'm new to jdepend. Tried it out and got the
> impression that we could benefit from using it in our
> project.
> However, if I do *NOT* put the jdepend library on the
> 'external' classpath, jdepend fails to do it's
> work. The problem with that is that I can not assume
> that other project members do have the jdepend
> extension on their classpath, e.g. included in ant's
> lib dir. Usually we deliver utility jars together with
> the project and add them to the project's classpath. I
> thought that this could be achieved
> by using the fork attribute and adding a classpath
> entry for the jdepend task. But it doesn't work.
>
> Instead I got the following error (I used verbose
> mode):
>
>
> C:\dev\projects\JJX\shared>ant -v jdepend
> Apache Ant version 1.5.3 compiled on April 16 2003
> Buildfile: build.xml
> Detected Java version: 1.4 in:
> C:\Java\j2sdk1.4.2_02\jre
> Detected OS: Windows XP
> parsing buildfile build.xml with URI =
> file:C:/dev/projects/JJX/shared/build.
> xml
> Project base dir set to: C:\dev\projects\JJX\shared
> Build sequence for target `jdepend' is [prerequisites,
> init, jdepend]
> Complete build sequence is [prerequisites, init,
> jdepend, clean, veryclean, real
> clean, generate, compile, declare, xgenerate, archive,
> jcsc, build-everything, p
> repare, makekey, dist-standalone-win, dist, wininst,
> installer, all, xviewcheck,
> runxcnf, runxcnfplus, encrypt, run, test, runpro,
> allmostall, doc]
>
> prerequisites:
>
> init:
> Property ${site} has not been set
> [property] Loading
> C:\dev\projects\JJX\shared\build.properties
> [copy] index.html omitted as index.html is up to
> date.
> [copy] xsl\category.xsl omitted as
> xsl/category.xsl is up to date.
> [copy] xsl\class.xsl omitted as xsl/class.xsl is
> up to date.
> [copy] xsl\overview.xsl omitted as
> xsl/overview.xsl is up to date.
> [copy] xsl\package.xsl omitted as xsl/package.xsl
> is up to date.
> [copy] xsl\packagelist.xsl omitted as
> xsl/packagelist.xsl is up to date.
> [copy] xsl\rule.xsl omitted as xsl/rule.xsl is up
> to date.
> [copy] xsl\severity.xsl omitted as
> xsl/severity.xsl is up to date.
> [dependset]
> C:\dev\projects\JJX\shared\gensrc\generic\dt\ui\build\impl\Action
> Impl.java is oldest target file
> [available] Found: gensrc\generic\dt\ui\build\UI.java
> [available] Found: .keystore
>
> jdepend:
>
> BUILD FAILED
> file:C:/dev/projects/JJX/shared/build.xml:835: Could
> not create task or type
> of type: jdepend.
>
> Ant could not find the task or a class this task
> relies upon.
>
> This is common and has a number of causes; the usual
> solutions are to read the manual pages then download
> and
> install needed JAR files, or fix the build file:
> - You have misspelt 'jdepend'.
> Fix: check your spelling.
> - The task needs an external JAR file to execute
> and this is not found at the right place in the
> classpath.
> Fix: check the documentation for dependencies.
> Fix: declare the task.
> - The task is an Ant optional task and optional.jar
> is absent
> Fix: look for optional.jar in ANT_HOME/lib,
> download if needed
> - The task was not built into optional.jar as
> dependent
> libraries were not found at build time.
> Fix: look in the JAR to verify, then rebuild with
> the needed
> libraries, or download a release version from
> apache.org
> - The build file was written for a later version of
> Ant
> Fix: upgrade to at least the latest release version
> of Ant
> - The task is not an Ant core or optional task
> and needs to be declared using <taskdef>.
>
> Remember that for JAR files to be visible to Ant tasks
> implemented
> in ANT_HOME/lib, the files must be in the same
> directory or on the
> classpath
>
> Please neither file bug reports on this problem, nor
> email the
> Ant mailing lists, until all of these causes have been
> explored,
> as this is not an Ant bug.
> at
> org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownEleme
> nt.java:351)
> at
> org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:26
> 7)
> at
> org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.jav
> a:115)
> at
> org.apache.tools.ant.Task.perform(Task.java:340)
> at
> org.apache.tools.ant.Target.execute(Target.java:309)
> at
> org.apache.tools.ant.Target.performTasks(Target.java:336)
> at
> org.apache.tools.ant.Project.executeTarget(Project.java:1339)
> at
> org.apache.tools.ant.Project.executeTargets(Project.java:1255)
> at
> org.apache.tools.ant.Main.runBuild(Main.java:609)
> at
> org.apache.tools.ant.Main.start(Main.java:196)
> at
> org.apache.tools.ant.Main.main(Main.java:235)
>
> Total time: 1 second
> C:\dev\projects\JJX\shared>
>
>
> Ant file sniffet looks as follows:
>
> <target name="jdepend" depends="init">
> <jdepend fork="true" format="xml"
> outputfile="${basedir}/${docs.dir}/jdepend/report.xml">
> <!--
> <classespath>
> <pathelement location="${build.dir}" />
> </classespath>
> -->
> <sourcespath>
> <pathelement location="${build.dir}" />
> </sourcespath>
> <classpath>
> <pathelement location="${build.dir}"/>
> <pathelement
> location="${lib.dir}/jdepend.jar"/>
> </classpath>
> </jdepend>
> <style basedir="${basedir}/${docs.dir}/jdepend"
> destdir="${basedir}/${docs.dir}/jdepend"
> includes="report.xml"
> style="${ant.home}/etc/jdepend.xsl" />
> </target>
>
>
> By the way, I'm certain that ${lib.dir}/jdepend.jar
> does EXIST!
>
> Did any one had the same problem or as an idea to
> tackle around. I also tried ant 1.5.4 and 1.6beta2
> with the same result.
>
> Thanks for any hint or help.
> -Robert
>
>
> PS: I recognized the new option -lib in ant 1.6beta2 which allows
> a caller of ant to specify additional jars on the command line.
> However, I did not find any means to express such a call
> inside the ant build file, which would gaive the writer of
> build files to include required knowledge of the build environment
> inside of the build file.
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> jdepend-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>




Sat Nov 22, 2003 7:10 pm

ROxspring
Offline Offline
Send Email Send Email

Forward
Message #41 of 72 |
Expand Messages Author Sort by Date

Hi, I'm new to jdepend. Tried it out and got the impression that we could benefit from using it in our project. However, if I do *NOT* put the jdepend library...
Robert Saenger
robert_saenger
Offline Send Email
Nov 22, 2003
3:04 pm

The classic way to tackle this in ant is to use the <available> task in the init target and then only run the jdepend target if the classes are present. ...
Rob Oxspring
ROxspring
Offline Send Email
Nov 22, 2003
7:10 pm

... In order for Ant to be able to execute a <jdepend> task, jdepend.jar must be in either the system CLASSPATH or the $ANT_HOME/lib directory. There are...
Mike Clark
clarkware
Offline Send Email
Nov 22, 2003
8:30 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help