ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Cannot use antlib:... with CppTasks!?!?!
Date Wed, 22 Oct 2003 08:20:45 GMT
On Tuesday 21 October 2003 19:26, Dominique Devienne wrote:
> I've turn around the pb for now by using the good old tasks/types
> properties resource, setting the URI explicitly:
>
>     <taskdef resource="cpptasks.tasks"
>              uri="antlib:net.nf.antcontrib.cpptasks" />
>     <typedef resource="cpptasks.types"
>              uri="antlib:net.nf.antcontrib.cpptasks" />
>
> I've also figured out that my antlib.xml is also not working with
> Ant-Contrib, as I thought it did (I use the same work around).
>
> I'm missing something here. Any help would be appreciated. Thanks, --DD
>
> PS: Peter, from the stack in UE, looks like you are swallowing the real
> cause of the exception, instead of nesting it in the BuildException. That
> would help troubleshoot problems like the one I'm seeing.

The problem is that the code cannot see this (not finding the antlib
resource) as an error since it is on a "fishing expedition". It is
legal and reasonable to do this:

<project name="test" xmlns:cpp="antlib:net.sf.antcontrib.cpptasks">
   <import file="common.xml"/>
   <cpp:compiler ...>
   ... etc
</project>

where common.xml contains:
<project>
   <!-- temp until antcontrib/cpptask have antlib.xml as a resource -->
  <taskdef resource="cpptasks.tasks" uri="antlib:net.sf.antcontrib.cpptasks"/>
  <typedef resource="cpptasks.types" uri="antlib:net.sf.antcontrib.cpptasks"/>
</project>

Peter

>
> > -----Original Message-----
> > From: Dominique Devienne [mailto:DDevienne@lgc.com]
> > Sent: Tuesday, October 21, 2003 11:55 AM
> > To: Ant Developers List
> > Cc: 'Ant-contrib-developers@lists.sourceforge.net'
> > Subject: Cannot use antlib:... with CppTasks!?!?!
> >
> > I'm a little baffled... I've added an antlib.xml to CppTasks.jar, which
> > is in ant/lib (as is AntContrib.jar). I've declared the
> > xmlns:cpp="antlib:net.nf.antcontrib.cpptasks" shortcut on the <project>
> > top-level element, and still it cannot find the <cpp:compiler> datatype.
> >
> > I originally used the cc namespace prefix instead of cpp, and thought it
> > might somehow conflict with the <cc> task define, but that's not it, as
> > cpp
> > doesn't work either as a prefix.
> >
> > After having used AntLib successfully with my own tasks, and
> > AntContrib's, I'm not really sure what could be wrong here! Could it be
> > the fact that the
> > resources loaded from the AntLib are in the default package? Bug?
> >
> > Help please. I've include all the relevant info I could think off. I hope
> > it's not too much... --DD
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>build -f cpptasks.xml
> > Buildfile: cpptasks.xml
> >
> > BUILD FAILED
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters\cpptasks.xml:7: Could not create
> > task
> > or type of type: antlib
> >
> > :net.nf.antcontrib.cpptasks:compiler.
> >
> > 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 'antlib:net.nf.antcontrib.cpptasks:compiler'.
> >    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.
> >
> > Total time: 0 seconds
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>type cpptasks.xml
> > <?xml version="1.0"?>
> >
> > <project xmlns="ant:core"
> >          xmlns:cpp="antlib:net.nf.antcontrib.cpptasks">
> >
> >   <cpp:compiler name="msvc" if="win32" id="win32.compiler"
> >                 debug="${debug}" exceptions="true" multithreaded="true"
> > />
> >
> > </project>
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>jar xf
> > ..\..\..\buildtools\ant\lib\cpptasks.jar net/sf/antcon
> > trib/cpptasks/antlib.xml
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>type
> > net\sf\antcontrib\cpptasks\antlib.xml
> > <?xml version="1.0"?>
> >
> > <antlib>
> >
> >   <taskdef resource="cpptasks.tasks" />
> >   <typedef resource="cpptasks.types" />
> >
> > </antlib>
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>build -f cpptasks.xml -debug
> > Apache Ant version 1.6beta compiled on September 30 2003
> > Buildfile: cpptasks.xml
> > Adding reference: ant.PropertyHelper ->
> > org.apache.tools.ant.PropertyHelper@a981ca
> > Detected Java version: 1.4 in: C:\pro\jdk1.4.2\jre
> > Detected OS: Windows 2000
> > Adding reference: ant.ComponentHelper ->
> > org.apache.tools.ant.ComponentHelper@118f375
> > Setting ro project property: ant.version -> Apache Ant version 1.6beta
> > compiled on September 30 2003
> >
> > Setting ro project property: ant.file ->
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters\cpptasks.xml
> > Adding reference: ant.projectHelper ->
> > org.apache.tools.ant.helper.ProjectHelper2@12152e6
> > Adding reference: ant.parsing.context ->
> > org.apache.tools.ant.helper.AntXMLContext@1ded0fd
> > Adding reference: ant.targets -> []
> > parsing buildfile P:\com_lgc\10.0.7\gocad\T-Surf\Filters\cpptasks.xml
> > with URI = file:///P:/com_lgc/
> > 10.0.7/gocad/T-Surf/Filters/cpptasks.xml
> > Setting ro project property: ant.file.null ->
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters\cpptasks.xml
> > Project base dir set to: P:\com_lgc\10.0.7\gocad\T-Surf\Filters
> >  +Target:
> > Adding reference: win32.compiler ->
> > org.apache.tools.ant.UnknownElement@86c347
> > Couldn't load Resource net/nf/antcontrib/cpptasks/antlib.xml
> >
> > BUILD FAILED
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters\cpptasks.xml:7: Could not create
> > task
> > or type of type: antlib
> >
> > :net.nf.antcontrib.cpptasks:compiler.
> >
> > 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 'antlib:net.nf.antcontrib.cpptasks:compiler'.
> >    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(UnknownElement.j
> >a va
> >
> > :471)
> >
> >         at
> > org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:391)
> >         at
> > org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:18
> >6 )
> >         at org.apache.tools.ant.Task.perform(Task.java:400)
> >         at org.apache.tools.ant.Target.execute(Target.java:338)
> >         at
> > org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:171)
> >         at
> > org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:12
> >6 )
> >         at org.apache.tools.ant.Main.runBuild(Main.java:653)
> >         at org.apache.tools.ant.Main.startAnt(Main.java:220)
> >         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:213)
> >         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
> >
> > Total time: 0 seconds
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>ant -diagnostics
> > 'ant' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>ant -diagnostic
> > 'ant' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>ant -h
> > 'ant' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>build -diagnostics
> > ------- Ant diagnostics report -------
> > Apache Ant version 1.6beta compiled on September 30 2003
> >
> > -------------------------------------------
> >  Implementation Version (JDK1.2+ only)
> > -------------------------------------------
> > core tasks     : 1.6
> > optional tasks : 1.6
> >
> > -------------------------------------------
> >  ANT_HOME/lib jar listing
> > -------------------------------------------
> > ant.home: P:\com_lgc\10.0.7\buildtools\ant\bin\..
> > activation.jar (45386 bytes)
> > ant-antlr.jar (5654 bytes)
> > ant-apache-bsf.jar (12254 bytes)
> > ant-apache-resolver.jar (3932 bytes)
> > ant-bcel.jar (8648 bytes)
> > ant-commons-logging.jar (3857 bytes)
> > ant-commons-net.jar (34807 bytes)
> > ant-contrib.jar (79361 bytes)
> > ant-icontract.jar (9677 bytes)
> > ant-jai.jar (21537 bytes)
> > ant-jakarta-regexp.jar (3722 bytes)
> > ant-javamail.jar (6761 bytes)
> > ant-jdepend.jar (7010 bytes)
> > ant-jmf.jar (6619 bytes)
> > ant-jsch.jar (20937 bytes)
> > ant-junit.jar (68911 bytes)
> > ant-launcher.jar (7687 bytes)
> > ant-log4j.jar (3026 bytes)
> > ant-netrexx.jar (9908 bytes)
> > ant-oro.jar (47897 bytes)
> > ant-starteam.jar (35258 bytes)
> > ant-stylebook.jar (2328 bytes)
> > ant-swing.jar (6629 bytes)
> > ant-trax.jar (67030 bytes)
> > ant-vaj.jar (48388 bytes)
> > ant-weblogic.jar (14449 bytes)
> > ant-xalan1.jar (3939 bytes)
> > ant-xalan2.jar (2491 bytes)
> > ant-xslp.jar (2238 bytes)
> > ant.jar (944931 bytes)
> > ashkelon.jar (152977 bytes)
> > bsf.jar (175348 bytes)
> > checkstyle-all.jar (681198 bytes)
> > commons-jxpath.jar (268794 bytes)
> > com_lgc_buildmagic.jar (270563 bytes)
> > cpptasks.jar (251506 bytes)
> > js.jar (390767 bytes)
> > junit.jar (121070 bytes)
> > mail.jar (280984 bytes)
> > nodeps.jar (392885 bytes)
> > xercesImpl.jar (927669 bytes)
> > xml-apis.jar (108484 bytes)
> >
> > -------------------------------------------
> >  Tasks availability
> > -------------------------------------------
> > image : Missing dependency com.sun.media.jai.codec.FileSeekableStream
> > sshexec : Missing dependency com.jcraft.jsch.UserInfo
> > scp : Missing dependency com.jcraft.jsch.UserInfo
> > rexec : Missing dependency org.apache.commons.net.SocketClient
> > stlist : Missing dependency com.starbase.starteam.Item
> > telnet : Missing dependency org.apache.commons.net.SocketClient
> > ftp : Missing dependency org.apache.commons.net.ftp.FTP
> > jdepend : Missing dependency jdepend.xmlui.JDepend
> > stcheckin : Missing dependency com.starbase.starteam.Item
> > stcheckout : Missing dependency com.starbase.starteam.Item
> >
> > -------------------------------------------
> >  org.apache.env.Which diagnostics
> > -------------------------------------------
> > Not available.
> > Download it at http://xml.apache.org/commons/
> >
> > -------------------------------------------
> >  XML Parser information
> > -------------------------------------------
> > XML Parser : org.apache.xerces.jaxp.SAXParserImpl
> > XML Parser Location: P:\com_lgc\10.0.7\buildtools\ant\lib\xercesImpl.jar
> >
> > -------------------------------------------
> >  System properties
> > -------------------------------------------
> > java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition
> > java.protocol.handler.pkgs : com.lgc.protocols
> > sun.boot.library.path : C:\pro\jdk1.4.2\jre\bin
> > java.vm.version : 1.4.2-b28
> > java.vm.vendor : Sun Microsystems Inc.
> > java.vendor.url : http://java.sun.com/
> > path.separator : ;
> > java.vm.name : Java HotSpot(TM) Client VM
> > file.encoding.pkg : sun.io
> > user.country : US
> > sun.os.patch.level : Service Pack 3
> > java.vm.specification.name : Java Virtual Machine Specification
> > user.dir : P:\com_lgc\10.0.7\gocad\T-Surf\Filters
> > java.runtime.version : 1.4.2-b28
> > java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
> > java.endorsed.dirs : C:\pro\jdk1.4.2\jre\lib\endorsed
> > os.arch : x86
> > java.io.tmpdir : C:\DOCUME~1\DDEVIE~1\LOCALS~1\Temp\
> > line.separator :
> >
> > java.vm.specification.vendor : Sun Microsystems Inc.
> > user.variant :
> > os.name : Windows 2000
> > ant.home : P:\com_lgc\10.0.7\buildtools\ant\bin\..
> > sun.java2d.fontpath :
> > java.library.path :
> > C:\pro\jdk1.4.2\bin;.;C:\WINNT\system32;C:\WINNT;C:\pro\vs\Common\msdev98
> >\ BI
> > N;C:
> > \pro\vs\VC98\BIN;C:\pro\vs\Common\TOOLS\WINNT;C:\pro\vs\Common\TOOLS;C:\W
> >I NN
> > T\system32;C:\WINNT;C:\W
> > INNT\System32\Wbem;C:\pro\exceed\Accessories\;C:\pro\bin;C:\pro\vim\vim62
> >; C:
> > \pro\jdk1.4.2\bin;C:\Pro
> > gram Files\Unified Messenger\Common
> > java.specification.name : Java Platform API Specification
> > java.class.version : 48.0
> > java.util.prefs.PreferencesFactory :
> > java.util.prefs.WindowsPreferencesFactory
> > os.version : 5.0
> > user.home : C:\Documents and Settings\ddevienne
> > user.timezone : America/Chicago
> > java.awt.printerjob : sun.awt.windows.WPrinterJob
> > file.encoding : Cp1252
> > java.specification.version : 1.4
> > java.class.path :
> > P:\com_lgc\10.0.7\buildtools\ant\bin\..\lib\ant-
> > launcher.jar;P:\com_lgc\10.0
> > .7\goc
> > ad\config\;P:\com_lgc\10.0.7\buildtools\ant\lib\activation.jar;P:\com_lgc
> >\ 10
> > .0.7\buildtools\ant\lib\
> > ant-antlr.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-apache-
> > bsf.jar;P:\com
> > _lgc\10.0.7\buildtools\a
> > nt\lib\ant-apache-resolver.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > bcel
> > .jar;P:\com_lgc\10.0.7\b
> > uildtools\ant\lib\ant-commons-
> > logging.jar;P:\com_lgc\10.0.7\buildtools\ant\l
> > ib\ant-commons-net.jar;P
> >
> > :\com_lgc\10.0.7\buildtools\ant\lib\ant-
> >
> > contrib.jar;P:\com_lgc\10.0.7\buildt
> > ools\ant\lib\ant-icontra
> > ct.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > jai.jar;P:\com_lgc\10.0.7\bu
> > ildtools\ant\lib\ant-jak
> > arta-regexp.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > javamail.jar;P:\com
> > _lgc\10.0.7\buildtools\a
> > nt\lib\ant-jdepend.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > jmf.jar;P:\c
> > om_lgc\10.0.7\buildtools
> > \ant\lib\ant-jsch.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > junit.jar;P:\
> > com_lgc\10.0.7\buildtool
> > s\ant\lib\ant-launcher.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > log4j.ja
> > r;P:\com_lgc\10.0.7\buil
> > dtools\ant\lib\ant-netrexx.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-
> > oro.
> > jar;P:\com_lgc\10.0.7\bu
> > ildtools\ant\lib\ant-
> > starteam.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\ant-s
> > tylebook.jar;P:\com_lgc\
> > 10.0.7\buildtools\ant\lib\ant-
> > swing.jar;P:\com_lgc\10.0.7\buildtools\ant\lib
> > \ant-trax.jar;P:\com_lgc
> > \10.0.7\buildtools\ant\lib\ant-
> > vaj.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\
> > ant-weblogic.jar;P:\com_
> > lgc\10.0.7\buildtools\ant\lib\ant-
> > xalan1.jar;P:\com_lgc\10.0.7\buildtools\an
> > t\lib\ant-xalan2.jar;P:\
> > com_lgc\10.0.7\buildtools\ant\lib\ant-
> > xslp.jar;P:\com_lgc\10.0.7\buildtools\
> > ant\lib\ant.jar;P:\com_l
> > gc\10.0.7\buildtools\ant\lib\ashkelon.jar;P:\com_lgc\10.0.7\buildtools\an
> >t \l
> > ib\bsf.jar;P:\com_lgc\10
> > .0.7\buildtools\ant\lib\checkstyle-
> > all.jar;P:\com_lgc\10.0.7\buildtools\ant\
> > lib\commons-jxpath.jar;P
> >
> > :\com_lgc\10.0.7\buildtools\ant\lib\com_lgc_buildmagic.jar;P:\com_lgc\10.
> > :0
> >
> > .7
> > \buildtools\ant\lib\cppt
> > asks.jar;P:\com_lgc\10.0.7\buildtools\ant\lib\js.jar;P:\com_lgc\10.0.7\bu
> >i ld
> > tools\ant\lib\junit.jar;
> > P:\com_lgc\10.0.7\buildtools\ant\lib\mail.jar;P:\com_lgc\10.0.7\buildtool
> >s \a
> > nt\lib\nodeps.jar;P:\com
> > _lgc\10.0.7\buildtools\ant\lib\xercesImpl.jar;P:\com_lgc\10.0.7\buildtool
> >s \a
> > nt\lib\xml-apis.jar;C:\p
> > ro\jdk1.4.2\lib\tools.jar
> > user.name : ddevienne
> > java.vm.specification.version : 1.0
> > java.home : C:\pro\jdk1.4.2\jre
> > sun.arch.data.model : 32
> > user.language : en
> > java.specification.vendor : Sun Microsystems Inc.
> > awt.toolkit : sun.awt.windows.WToolkit
> > java.vm.info : mixed mode
> > java.version : 1.4.2
> > java.ext.dirs : C:\pro\jdk1.4.2\jre\lib\ext
> > sun.boot.class.path :
> > C:\pro\jdk1.4.2\jre\lib\rt.jar;C:\pro\jdk1.4.2\jre\lib\i18n.jar;C:\pro\jd
> >k 1.
> > 4.
> > 2\jre\lib\sunrsasign.jar;C:\pro\jdk1.4.2\jre\lib\jsse.jar;C:\pro\jdk1.4.2
> >\ jr
> > e\lib\jce.jar;C:\pro\jdk
> > 1.4.2\jre\lib\charsets.jar;C:\pro\jdk1.4.2\jre\classes
> > java.vendor : Sun Microsystems Inc.
> > file.separator : \
> > java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
> > sun.io.unicode.encoding : UnicodeLittle
> > sun.cpu.endian : little
> > sun.cpu.isalist : pentium i486 i386
> >
> > P:\com_lgc\10.0.7\gocad\T-Surf\Filters>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail: dev-help@ant.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org


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


Mime
View raw message