Apache Axis2:[TaskDef] 无法从资源轴 - tasks.properties 加载定义。找不到

Apache Axis2: [TaskDef] Could not load definitions from resource axis-tasks.properties. It could not be found

我正在使用 Axis2 1.6.x 测试 Web 服务,我正在使用 Ant 来构建和部署它。 我已将构建脚本设置为:

build.xml:

<?xml version="1.0"?>
<project name="Hello World WebService" basedir="." default="about.author">
<property name="properties.file" location="build.properties"/>
<property file="${properties.file}"/>

<import file="build-webservice.xml" />
</project>

build-webservice.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Hello World - Sub build" basedir=".">

    <path id="classpath.servlet">
        <pathelement location="." />
        <fileset dir="${javax.servlet.home.dir}" >
            <include name="**/*.jar" />
        </fileset>
    </path>


    <path id="classpath.axis">
    <!--
        <fileset dir="${absolute.axis.lib.dir}">
            <include name="**/*.jar" />
        </fileset>
    -->
        <fileset dir="${absolute.tomcat.axis.lib.dir}">
            <include name="**/*.jar" />
        </fileset>
        <fileset dir="${javamail.home.dir}">
            <include name="**/*.jar" />
        </fileset>
        <fileset dir="${jaf.home.dir}">
            <include name="**/*.jar" />
        </fileset>
        <pathelement path="${absolute.axis.lib.dir}" />
    </path>

        <taskdef
            resource="axis-tasks.properties"
            classpathref="classpath.axis" />

    <target name="clean.webservice" description="Delete webservice build directory">
        <delete dir="${webservice.build.dir}" />
        <delete dir="${webservice.dist.dir}" />
    </target>

    <target name="make.webservice.dir" depends="clean.webservice" description="Create webservice build directory">
        <mkdir dir="${webservice.build.dir}" />
        <mkdir dir="${webservice.dist.dir}" />
    </target>

    <target name="compile.webservice" depends="make.webservice.dir" description="Compile webservice src">
        <javac destdir="${webservice.build.dir}" nowarn="${build.compiler.nowarn}" debug="${build.compiler.compile.with.debug}">
        <src path="${webservice.src.dir}" />
        <classpath>
            <path refid="classpath.servlet" />
        </classpath>
        </javac>
    </target>

    <target name="create.webservice.jar" depends="compile.webservice" description="Create webservice jar">
        <jar destfile="${webservice.jar.file}">
            <fileset dir="${webservice.build.dir}">
                <include name="**/*.class" />
            </fileset>
        </jar>
    </target>

    <target name="deploy.webservice.jar" depends="create.webservice.jar" description="Deploy webservice jar">
        <copy file="${webservice.jar.file}" todir="${absolute.tomcat.axis.lib.dir}" />
    </target>

    <target name="deploy.webservice" depends="deploy.webservice.jar" description="Deploy webservice on axis">
        <axis-admin
            url="http://localhost:8080/axis2/axis2-admin"
            xmlfile="${deploy.wsdd.file}" />
    </target>

    <target name="undeploy.webservice" description="Undeploy webservice">
        <axis-admin
            url="http://localhost:8080/axis2/axis2-admin" 
            xmlfile="${undeploy.wsdd.file}" />
    </target>
</project>

由于 build.properties 的长度,我将跳过它。但是当我使用时,

ant -p

我得到:

Buildfile: `build.xml`
  [taskdef] Could not load definitions from resource axis-tasks.properties. It could not be found.

Main targets:

 about.author           About the author
 clean.webservice       Delete webservice build directory
 compile.webservice     Compile webservice src
 create.webservice.jar  Create webservice jar
 deploy.webservice      Deploy webservice on axis
 deploy.webservice.jar  Deploy webservice jar
 make.webservice.dir    Create webservice build directory
 undeploy.webservice    Undeploy webservice

部署时,

ant deploy.webservice

我明白了,

BUILD FAILED
/home/mwangi/NetBeansProjects/Webservices/masterbuild/build-webservice.xml:68: Problem: failed to create task or type axis-admin
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.

几年前,我在使用 Axis 1.4 时遇到了同样的错误,我通过更正我定义为 属性 的 Axis 库目录解决了这个问题。但是现在 lib 目录没问题,但我不明白是什么导致了这个错误。 考虑到我的类路径没问题,我该如何修复 TaskDef?

轴 1.6 不存在。有 Axis 1.4 和 Axis2 1.6.0。您的构建脚本是为 Axis 设计的,不适用于 Axis2。