同时显示错误执行ant命令:资源axis-tasks.properties找不到 [英] ant command showing error while execution : resource axis-tasks.properties could not be found

查看:1210
本文介绍了同时显示错误执行ant命令:资源axis-tasks.properties找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题在运行ant示值误差不能加载从资源axis-tasks.properties定义。它不能被找到:


  

下面是其中出现问题

build.xml文件的快照

 <目标名称=轴取决于=prepare>
      <的taskdef资源=axis-tasks.properties/>      <轴WSDL2Java的URL =$ {} webconsole.base /src/myservice.wsdl
            输出=$ {} axis.output>
        <映射
            命名空间=瓮:为MyService
            包=com.company.service/>
        <映射
            命名空间=htt​​p://webserviceurl.com
            包=com.company.service/>
      < /轴的WSDL2Java>
    < /目标与GT;

在运行下面的错误蚂蚁所示:

  /build.xml:76:问题:无法创建任务或类型轴的WSDL2Java
原因:这个名字是不确定的。
操作:检查拼写。
操作:检查所有的自定义任务/类型已经被宣布。
操作:检查任何与LT; presetdef> /< macrodef>声明发生。

环保性能:

 出口TMPDIR = $ HOME / tmp目录
出口RELEASE = $ HOME /释放
出口JAVA_HOME =的/ usr / JAVA /电流
出口ANT_HOME =的/ usr /本地/ Apache-ANT-1.6.5
出口PATH = $ JAVA_HOME /斌:$ ANT_HOME /斌:$ PATH

其他信息

其实,我们有两个版本的机器。第一个只有root用户和我们创造的/ home /用户文件夹例如手动/家庭/拉詹等。当我们运行这台机器的蚂蚁作为root / home中/拉詹/ R7_SP1_UTF8 / vermaraj_R7_SP1 / VOB的/项目/ ip_src / AdminWebConsole蚂蚁的正常工作的。

回声$ PATH = /usr/java/current/bin:/usr/local/apache-ant-1.6.5/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

在第二台机器,我们已经创建单独的用户帐户,当我们尝试和运行的蚂蚁root身份或拉詹 / home中/拉詹/ R7_SP1_UTF8 / vermaraj_R7_SP1 / VOB的/项目/ ip_src / AdminWebConsole蚂蚁的不正常工作

回声$ PATH:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root /斌

此外,在这两个版本的机器回声$ CLASSPATH为空

定位轴的ant.jar使输出为:


  1. /home/Rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole/lib/axis-ant.jar

  2. /home/Rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole/output/war/WEB-INF/lib/axis-ant.jar

  3. /usr/local/apache-ant-1.6.5/lib/axis-ant.jar

常春藤是不是一种选择,因为这是非常大的code库的一部分,如果我们增加额外的库可能会产生问题。


解决方案

Ant任务确实出现有一组复杂的依赖的。我建议加入常春藤扩展来管理这些。

示例

 ├──的build.xml
├──SRC
│└──myservice.wsdl
└──目标
    └──输出
        └──COM
            └──例子
                └──WWW
                    └──WSDL
                        └──HelloService_wsdl
                            ├──Hello_BindingStub.java
                            ├──Hello_PortType.java
                            ├──Hello_Service.java
                            └──Hello_ServiceLocator.java

的build.xml

 <项目名称=演示默认为轴的xmlns:常春藤=的antlib:org.apache.ivy.ant>    <! - 
    ================
    构建属性
    ================
     - >
    <属性名=build.dir位置=目标/>
    <属性名=axis.output位置=$ {} build.dir /输出/>    <用类名=org.apache.ivy.Main属性=ivy.installed/>    <! -
    ===========
    目标
    ===========
     - >
    <目标名称=安装 - 常青藤描述=安装常青藤,除非=ivy.installed>
        < MKDIR DIR =$ {}的user.home /蚂蚁/ lib目录下。/>
        <获得DEST =$ {}的user.home /蚂蚁/ lib目录/ ivy.jarSRC =htt​​p://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0 /ivy-2.3.0.jar\"/>
        <失败=常春藤已经安装再次运行版本。消息/>
    < /目标与GT;    <目标名称=解析取决于=安装 - 常青藤描述=使用常春藤解析类路径>
        <常春藤:cachepath PATHID =build.path>
            <依赖有机=org.apache.axisNAME =轴蚁族REV =1.4/>
            <依赖有机=org.apache.axisNAME =轴REV =1.4/>
            <依赖有机=org.apache.axisNAME =轴JAXRPCREV =1.4/>
            <依赖有机=的commons-loggingNAME =的commons-loggingREV =1.1.1/>
            <依赖有机=公地发现NAME =公地发现REV =0.4/>
            <依赖有机=WSDL4JNAME =WSDL4JREV =1.6.2/>
        < /常春藤:cachepath>
    < /目标与GT;    <目标名称=轴取决于=决心描述=运行轴任务>
        <的taskdef资源=axis-tasks.propertiesclasspathref =build.path/>        < MKDIR DIR =$ {} axis.output/>        <轴WSDL2Java的URL =SRC / myservice.wsdl输出=$ {} axis.output>
            <映射命名空间=瓮:为MyService包=com.company.service/>
            <映射命名空间=htt​​p://webserviceurl.com包=com.company.service/>
        < /轴的WSDL2Java>
    < /目标与GT;    <目标名称=干净描述=干净的工作空间>
        <删除DIR =$ {} build.dir/>
    < /目标与GT;    <目标名称=干净所有取决于=干净描述=清除缓存常青藤>
        <常春藤:cleancache />
    < /目标与GT;< /项目>

Problem in running ant showing error Could not load definitions from resource axis-tasks.properties. It could not be found :

Here is the snapshot of build.xml on which the problem occurs

 <target name="axis" depends="prepare">
      <taskdef resource="axis-tasks.properties"/> 

      <axis-wsdl2java url="${webconsole.base}/src/myservice.wsdl"
            output="${axis.output}">
        <mapping
            namespace="urn:myservice"
            package="com.company.service" />
        <mapping
            namespace="http://webserviceurl.com"
            package="com.company.service" />
      </axis-wsdl2java>
    </target>

When running ant shows following errors :

/build.xml:76: Problem: failed to create task or type axis-wsdl2java
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.

Environment properties :

export TMPDIR=$HOME/tmp
export RELEASE=$HOME/Release
export JAVA_HOME=/usr/java/current
export ANT_HOME=/usr/local/apache-ant-1.6.5
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

Additional information

Actually, we have two build machines. First one has only root user and we have created /home/user folders manually e.g. /home/rajan etc. In this machine when we run ant as root from /home/rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole ant works properly.

echo $PATH = /usr/java/current/bin:/usr/local/apache-ant-1.6.5/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

On the second machine, we have created individual user accounts and when we try and run ant either as root or rajan from /home/rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole ant does not works properly.

echo $PATH : /usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Also, in both the build machines echo $CLASSPATH is empty

locate axis-ant.jar gives output as :

  1. /home/Rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole/lib/axis-ant.jar
  2. /home/Rajan/R7_SP1_UTF8/vermaraj_R7_SP1/vobs/project/ip_src/AdminWebConsole/output/war/WEB-INF/lib/axis-ant.jar
  3. /usr/local/apache-ant-1.6.5/lib/axis-ant.jar

ivy is not an option as this is part of very big code base, it may create problems if we add additional libraries.

解决方案

The ANT task does appear to have a complex set of dependencies. I would recommend adding the ivy extension to manage these.

Example

├── build.xml
├── src
│   └── myservice.wsdl
└── target
    └── output
        └── com
            └── examples
                └── www
                    └── wsdl
                        └── HelloService_wsdl
                            ├── Hello_BindingStub.java
                            ├── Hello_PortType.java
                            ├── Hello_Service.java
                            └── Hello_ServiceLocator.java

build.xml

<project name="demo" default="axis" xmlns:ivy="antlib:org.apache.ivy.ant">

    <!--
    ================
    Build properties
    ================
    -->
    <property name="build.dir"   location="target"/>
    <property name="axis.output" location="${build.dir}/output"/>

    <available classname="org.apache.ivy.Main" property="ivy.installed"/> 

    <!--
    ===========
    Targets
    ===========
    -->
    <target name="install-ivy" description="Install ivy" unless="ivy.installed">
        <mkdir dir="${user.home}/.ant/lib"/>
        <get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
        <fail message="Ivy has been installed. Run the build again"/>
    </target>

    <target name="resolve" depends="install-ivy" description="Use ivy to resolve classpaths">
        <ivy:cachepath pathid="build.path">
            <dependency org="org.apache.axis" name="axis-ant" rev="1.4" />
            <dependency org="org.apache.axis" name="axis" rev="1.4" />
            <dependency org="org.apache.axis" name="axis-jaxrpc" rev="1.4"/>
            <dependency org="commons-logging" name="commons-logging" rev="1.1.1" />
            <dependency org="commons-discovery" name="commons-discovery" rev="0.4" />
            <dependency org="wsdl4j" name="wsdl4j" rev="1.6.2" />
        </ivy:cachepath>
    </target>

    <target name="axis" depends="resolve" description="Run Axis task">
        <taskdef resource="axis-tasks.properties" classpathref="build.path"/> 

        <mkdir dir="${axis.output}"/>

        <axis-wsdl2java url="src/myservice.wsdl" output="${axis.output}">
            <mapping namespace="urn:myservice" package="com.company.service" />
            <mapping namespace="http://webserviceurl.com" package="com.company.service" />
        </axis-wsdl2java>
    </target>

    <target name="clean" description="Clean workspace">
        <delete dir="${build.dir}"/>
    </target>

    <target name="clean-all" depends="clean" description="Purge ivy cache">
        <ivy:cleancache/>
    </target>

</project>

这篇关于同时显示错误执行ant命令:资源axis-tasks.properties找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆