We are doing a web service project with Axis 1.x, and I am having problems making Maven build work.
I do
mvn clean generate-sources
which runs the axistools-maven-plugin wsdl2java . It is eventually interrupted by
[INFO] [axistools:wsdl2java {execution: generate-project}] [INFO] about to add compile source root [INFO] Processing wsdl: C:\Project\src\main\webapp\WEB-INF\wsdl\project.wsdl Jan 24, 2011 11:24:58 AM org.apache.axis.utils.JavaUtils isAttachmentSupported WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error generating Java code from WSDL. Embedded error: Error running Axis C:\Project\src\main\webapp\WEB-INF\project.xsd (The system cannot find the file specified)
It is right. This file does not exist. (And -e does not provide additional useful information - this is a LifecycleExecutionException caused by a MojoExecutionException caused by an AxisPluginException caused by a FileNotFoundException.)
The fact is that he should not look for WEB-INF\project.xsd , he should get access to WEB-INF\wsdl\project.xsd .
Here is what WSDL says:
<wsdl:types> <xsd:schema targetNamespace="http://domain/project/"> <xsd:import namespace="http://domain/schema/" schemaLocation="project.xsd"/> </xsd:schema> </wsdl:types>
This seems to work great for all my colleagues. We all use Maven 2.2.1, and axistools-maven-plugin is bound to 1.4 with the following configuration:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>axistools-maven-plugin</artifactId> <version>1.4</version> <executions> <execution> <id>generate-project</id> <goals> <goal>wsdl2java</goal> </goals> <configuration> <sourceDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl/</sourceDirectory> <outputDirectory>target/generated-sources</outputDirectory> <serverSide>true</serverSide> <testCases>false</testCases> <wrapArrays>false</wrapArrays> </configuration> </execution> </executions> </plugin>
I already cleaned up my local Maven repository completely, hoping it was a rogue addiction, but that didn't change anything. Any idea what might be causing this only to me, but not to my colleagues?
EDIT 1: I tried changing schemaLocation to wsdl/project.xsd (for testing purposes only, I will not make any permanent changes to WSDL) and got this funny result:
Embedded error: Error running Axis WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'wsdl\project.xsd', relative to 'file:/C:/Project/src/main/webapp/WEB-INF/wsdl/project.wsdl'.: This file was not found: file:/C:/Project/src/main/webapp/WEB-INF/wsdl/wsdl/project.xsd
If you, like me, now think that perhaps ./project.xsd might work ... no, sorry, it makes him search directly for WEB-INF/project.xsd again.
EDIT 2: Okay, now axistools is just teasing me ...
../project.xsd
-> src/main/webapp/project.xsd (incorrect)
../wsdl/project.xsd
-> src/main/webapp/wsdl/project.xsd ( src/main/webapp/wsdl/project.xsd )
../WEB-INF/wsdl/project.xsd
-> src/main/webapp/WEB-INF/WEB-INF/wsdl/project.xsd (incorrect)
As a reminder, the correct path would be src/main/webapp/WEB-INF/wsdl/project.xsd .