您引用的 Jira 链接与 Maven 相关,因此没有相关性。我怀疑您的问题与您的 ANT 环境有关。
您是否将罐子放在以下位置之一?
- $ANT_HOME/lib
- $HOME/.ant/lb
这些将自动添加到您的类路径中,并可能导致此报告的类冲突。调查类路径问题的一个好方法是在调试和/或诊断模式下运行 ANT。
ant generate.wsdl -diagnostics
将包括一份关于 ANT 加载了哪些 jar 以及在何处加载的报告。
工作示例
使用 ANT 1.9.0
$ ant -version
Apache Ant(TM) version 1.9.0 compiled on March 5 2013
我从下载的axis2发行版中提取了快速入门项目
$ cp -r $AXIS2_HOME/samples/quickstart .
$ tree
.
└── quickstart
├── build.xml
├── README.txt
├── resources
│ └── META-INF
│ └── services.xml
└── src
└── samples
└── quickstart
└── service
└── pojo
└── StockQuoteService.java
运行
$ ant -f quickstart/build.xml generate.wsdl -DAXIS2_HOME=$AXIS2_HOME
Buildfile: /home/mark/tmp/quickstart/build.xml
compile.service:
[mkdir] Created dir: /home/mark/tmp/quickstart/build
[mkdir] Created dir: /home/mark/tmp/quickstart/build/classes
[javac] /home/mark/tmp/quickstart/build.xml:42: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /home/mark/tmp/quickstart/build/classes
[javac] Note: /home/mark/tmp/quickstart/src/samples/quickstart/service/pojo/StockQuoteService.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
generate.wsdl:
[java2wsdl] log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
[java2wsdl] log4j:WARN Please initialize the log4j system properly.
BUILD SUCCESSFUL
Total time: 2 seconds
生成预期的文件
$ tree
.
├── build
│ └── StockQuoteService.wsdl
└── quickstart
├── build
│ └── classes
│ └── samples
│ └── quickstart
│ └── service
│ └── pojo
│ └── StockQuoteService.class
├── build.xml
├── README.txt
├── resources
│ └── META-INF
│ └── services.xml
└── src
└── samples
└── quickstart
└── service
└── pojo
└── StockQuoteService.java
ANT 调试输出显示正在使用的 AXIS2 commons-logging jar:
$ ant -f quickstart/build.xml generate.wsdl -DAXIS2_HOME=$AXIS2_HOME -debug | grep "org/apache/commons/logging"
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogConfigurationException.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory$6.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/WeakHashtable.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory$1.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/WeakHashtable$Referenced.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/WeakHashtable$WeakKey.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory$4.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory$3.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/LogFactory$2.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/LogFactoryImpl.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/LogFactoryImpl$2.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/LogFactoryImpl$1.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/impl/Log4JLogger.class
Loaded from /opt/axis2-1.6.2/lib/commons-logging-1.1.1.jar org/apache/commons/logging/Log.class