1
votes

Problem:

C:\Users\<user>\Documents\NetBeansProjects\WebServiceClientTest\build.xml:102: Problem: failed to create task or type taget
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

My build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="WebServiceClientTest" default="default" basedir=".">
    <description>Builds, tests, and runs the project WebServiceClientTest.</description>
    <import file="nbproject/build-impl.xml"/>

    <!--
    <propertyset id="proxy.properties">
  <propertyref prefix="java.net.useSystemProxies"/>
  <propertyref prefix="http."/>
  <propertyref prefix="https."/>
  <propertyref prefix="ftp."/>
  <propertyref prefix="socksProxy"/>
   </propertyset>
        -->
   <taskdef resource="net/sf/antcontrib/antlib.xml"/> 

   <property name="jaxws-version" value="2.0" />
   <property name="jar.file" value="${ant.project.name}.jar"/>
    <property name ="generated" value="generated" />
    <property name ="generated.src" value="${generated}/src" />
    <property name ="classes.dir" value="bin" />
    <property name ="wsimport.exec" value="C:\Program Files\Java\jdk1.8.0_65\bin\wsimport.exe" />

    <target name="clean">
        <delete failonerror="false" includeemptydirs="true">
            <fileset dir="${generated.src}" />
        </delete>
        <mkdir dir="${generated}" />
        <mkdir dir="${generated.src}" />
    </target>

    <target name="release" depends="clean,create-rueck-service, jar" />

    <target name="create-rueck-service">
        <antcall target="create-ws">
            <param name="package" value="webserviceclienttest" />
            <param name="wsdl.location" value="C:\Users\me\Documents\NetBeansProjects\WebServiceClientTest\src\webserviceclienttest\rueck.wsdl" />
        </antcall>
    </target>

       <target name="jar">
      <jar destfile="release/${jar.file}">
         <zipfileset dir="${classes.dir}" includes="**/*.*" />
      </jar>
   </target>

    <target name="create-ws">
        <exec executable="${wsimport.exec}" >
            <arg value="-s" />
            <arg value="${generated.src}" />
            <arg value="-d" />
            <arg value="${classes.dir}" />
            <arg value="-p" />
            <arg value="${package}" />
            <arg value="${wsdl.location}" />
        </exec>
    </target>
</project>

My Installation:

  • ANT_HOME
  • JAVA_HOME
  • PATH added %ANT_HOME%/bin

I have added ant-contrib-1.0b3.jar (~220kb) to my ANT/lib folder

I can access ANT over command line by tipping ant.

Diagnostics:

BUILD FAILED
C:\Users\<user>\Documents\NetBeansProjects\WebServiceClientTest\build.xml:
102: Problem: failed to create task or type taget
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


C:\Windows\System32>ant -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.9.4 compiled on April 29 2014

-------------------------------------------
 Implementation Version
-------------------------------------------
core tasks     : 1.9.4 in file:/C:/Program%20Files/NetBeans%208.1/extide/ant/lib
/ant.jar

-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
ant.java.version: 1.8
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: C:\Program Files\NetBeans 8.1\extide\ant\lib\ant.jar
ant.home: C:\Program Files\NetBeans 8.1\extide\ant

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.home: C:\Program Files\NetBeans 8.1\extide\ant
ant-antlr.jar (11564 bytes)
ant-apache-bcel.jar (15097 bytes)
ant-apache-bsf.jar (9831 bytes)
ant-apache-log4j.jar (8681 bytes)
ant-apache-oro.jar (9812 bytes)
ant-apache-regexp.jar (9676 bytes)
ant-apache-resolver.jar (9752 bytes)
ant-apache-xalan2.jar (8202 bytes)
ant-commons-logging.jar (9794 bytes)
ant-commons-net.jar (90857 bytes)
ant-contrib-1.0b3.jar (224277 bytes)
ant-jai.jar (28332 bytes)
ant-javamail.jar (13784 bytes)
ant-jdepend.jar (13826 bytes)
ant-jmf.jar (12395 bytes)
ant-jsch.jar (46798 bytes)
ant-junit.jar (117005 bytes)
ant-junit4.jar (13208 bytes)
ant-launcher.jar (18346 bytes)
ant-netrexx.jar (16285 bytes)
ant-swing.jar (13283 bytes)
ant-testutil.jar (21356 bytes)
ant.jar (2011609 bytes)

-------------------------------------------
 USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: C:\Users\<user>
No such directory.

-------------------------------------------
 Tasks availability
-------------------------------------------
image : Missing dependency javax.media.jai.PlanarImage
sshexec : Missing dependency com.jcraft.jsch.Logger
scp : Missing dependency com.jcraft.jsch.Logger
sshsession : Missing dependency com.jcraft.jsch.Logger
jdepend : Missing dependency jdepend.xmlui.JDepend
A task being missing/unavailable should only matter if you are trying to use it

-------------------------------------------
 org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/

-------------------------------------------
 XML Parser information
-------------------------------------------
XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
XML Parser Location: unknown
Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$J
AXPSAXParser
Namespace-aware parser Location: unknown

-------------------------------------------
 XSLT Processor information
-------------------------------------------
XSLT Processor : com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
XSLT Processor Location: unknown

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : C:\Program Files\Java\jdk1.8.0_65\jre\bin
java.vm.version : 25.65-b01
ant.library.dir : C:\Program Files\NetBeans 8.1\extide\ant\lib
java.vm.vendor : Oracle Corporation
java.vendor.url : http://java.oracle.com/
path.separator : ;
java.vm.name : Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg : sun.io
user.script :
user.country : DE
sun.java.launcher : SUN_STANDARD
sun.os.patch.level :
java.vm.specification.name : Java Virtual Machine Specification
user.dir : C:\Windows\System32
java.runtime.version : 1.8.0_65-b17
java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs : C:\Program Files\Java\jdk1.8.0_65\jre\lib\endorsed
os.arch : amd64
java.io.tmpdir : C:\Users\user~1.OEN\AppData\Local\Temp\
line.separator :

java.vm.specification.vendor : Oracle Corporation
user.variant :
os.name : Windows 8.1
ant.home : C:\Program Files\NetBeans 8.1\extide\ant
sun.jnu.encoding : Cp1252
java.library.path : C:\Program Files\Java\jdk1.8.0_65\bin;C:\WINDOWS\Sun\Java\bi
n;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Cl
ient\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND
OWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\W
IDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;
C:\Program Files (x86)\Security Innovation\SI TSS\bin\;C:\Program Files\Intel\Wi
Fi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Int
el\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Man
agement Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management E
ngine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Com
ponents\IPT;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files
(x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL S
erver\110\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)
\Windows Live\Shared;C:\Users\<user>\Documents\sapjco3-NTAMD64-3.0.14;C:\P
rogram Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program File
s\NetBeans 8.1\extide\ant\bin;.
java.specification.name : Java Platform API Specification
java.class.version : 52.0
sun.management.compiler : HotSpot 64-Bit Tiered Compilers
os.version : 6.3
user.home : C:\Users\<user>
user.timezone : Europe/Berlin
java.awt.printerjob : sun.awt.windows.WPrinterJob
java.specification.version : 1.8
file.encoding : Cp1252
user.name : <user>
java.class.path : C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-launcher.jar;
C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-antlr.jar;C:\Program Files\NetB
eans 8.1\extide\ant\lib\ant-apache-bcel.jar;C:\Program Files\NetBeans 8.1\extide
\ant\lib\ant-apache-bsf.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-apa
che-log4j.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-apache-oro.jar;C:
\Program Files\NetBeans 8.1\extide\ant\lib\ant-apache-regexp.jar;C:\Program File
s\NetBeans 8.1\extide\ant\lib\ant-apache-resolver.jar;C:\Program Files\NetBeans
8.1\extide\ant\lib\ant-apache-xalan2.jar;C:\Program Files\NetBeans 8.1\extide\an
t\lib\ant-commons-logging.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-c
ommons-net.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-contrib-1.0b3.ja
r;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-jai.jar;C:\Program Files\NetB
eans 8.1\extide\ant\lib\ant-javamail.jar;C:\Program Files\NetBeans 8.1\extide\an
t\lib\ant-jdepend.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-jmf.jar;C
:\Program Files\NetBeans 8.1\extide\ant\lib\ant-jsch.jar;C:\Program Files\NetBea
ns 8.1\extide\ant\lib\ant-junit.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib
\ant-junit4.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant-launcher.jar;C:
\Program Files\NetBeans 8.1\extide\ant\lib\ant-netrexx.jar;C:\Program Files\NetB
eans 8.1\extide\ant\lib\ant-swing.jar;C:\Program Files\NetBeans 8.1\extide\ant\l
ib\ant-testutil.jar;C:\Program Files\NetBeans 8.1\extide\ant\lib\ant.jar;C:\Prog
ram Files\Java\jdk1.8.0_65\lib\tools.jar
java.vm.specification.version : 1.8
sun.arch.data.model : 64
java.home : C:\Program Files\Java\jdk1.8.0_65\jre
sun.java.command : org.apache.tools.ant.launch.Launcher -diagnostics
java.specification.vendor : Oracle Corporation
user.language : de
awt.toolkit : sun.awt.windows.WToolkit
java.vm.info : mixed mode
java.version : 1.8.0_65
java.ext.dirs : C:\Program Files\Java\jdk1.8.0_65\jre\lib\ext;C:\WINDOWS\Sun\Jav
a\lib\ext
sun.boot.class.path : C:\Program Files\Java\jdk1.8.0_65\jre\lib\resources.jar;C:
\Program Files\Java\jdk1.8.0_65\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_65
\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\jsse.jar;C:\Pr
ogram Files\Java\jdk1.8.0_65\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_65\j
re\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_65\jre\lib\jfr.jar;C:\Program
 Files\Java\jdk1.8.0_65\jre\classes
sun.stderr.encoding : cp850
java.vendor : Oracle Corporation
file.separator : \
java.vendor.url.bug : http://bugreport.sun.com/bugreport/
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.stdout.encoding : cp850
sun.desktop : windows
sun.cpu.isalist : amd64

-------------------------------------------
 Temp dir
-------------------------------------------
Temp dir is C:\Users\user~1.OEN\AppData\Local\Temp\
Temp dir is writeable
Temp dir alignment with system clock is 481 ms

-------------------------------------------
 Locale information
-------------------------------------------
Timezone Mitteleuropäische Zeit offset=3600000

-------------------------------------------
 Proxy information
-------------------------------------------
Java1.5+ proxy settings:
Direct connection

BTW: I have used an online wsdl location but i was affraid using it because i need some proxy settings etc.

2
Which one is line 102 ?simar
as mentioned in build.xml with <taget name="create-ws"> <!-- line 102 -->user1104836
I missed it at first blushsimar

2 Answers

1
votes

Since source taken from here

http://blog.axxg.de/java-soap-web-service-client-schreiben/

Let's remark documentaion of ant

the base directory from which all path calculations are done. This attribute might be overridden by setting the "basedir" property beforehand. When this is done, it must be omitted in the project tag. If neither the attribute nor the property have been set, the parent directory of the buildfile will be used.

File build.xml defines basedir as basedir=".". Which is in java very tricky. Usually it means the directory in which jvm machine was started. But in here i believe it points to folder where build.xml located.

Look inside of folder where build.xml located suppose to be folder generated and generated/src. Generated sources must be located in there then.

0
votes

failed to create task or type taget

Keyword taget suppose to be target