Sergey,
It didnt seem to work for us. As we are traversing a jar file our
problem is slightly different than the one you are testing. I am
attaching a sample project that demonstrates the problem and
a potential patch to fix it; using java.net.URL rather than java.net.URI
fixes the issue for us.
Thanks,
Mike
On Thu, Apr 4, 2013 at 10:10 AM, Michael Lambert
<[email protected]<mailto:michael@**michaellambert.com<[email protected]>>>
wrote:
I will do it Monday Sergey. I really appreciate the effort!
On Thu, Apr 4, 2013 at 9:51 AM, Sergey Beryozkin
<[email protected]<mailto:[email protected]>> wrote:
Hi,
On 03/04/13 00:13, Michael Lambert wrote:
Its an essential feature for me unfortunately as I want to
centrally manage
all of my schemas so they can be easily discovered and
reused. I need to be
able to navigate around a jar to choose the ones I want to
import. If I can
be any help please let me know.
I think I've fixed it, see [1]
Can you please help on your end with trying 2.5.x SNAPSHOTS (as
far as I recall you work with 2.5.x) in a day or two, or may be
rebuilding 2.5.x locally and trying that ?
Cheers, Sergey
[1]
https://issues.apache.org/__**jira/browse/CXF-4946<https://issues.apache.org/__jira/browse/CXF-4946>
<https://issues.apache.org/**jira/browse/CXF-4946<https://issues.apache.org/jira/browse/CXF-4946>
On Tue, Apr 2, 2013 at 3:38 PM, Sergey
Beryozkin<[email protected]
<mailto:[email protected]>_**_>wrote:
Hi
It is the problem with resolving ".." against the base
URI, you can have
the schemas located in the same folder as the actual
WADL or in child
folders, example, schemas/myschema.xsd.
I'll have a look later on and see if ".." can be
supported too
Cheers, Sergey
On 02/04/13 16:45, Michael Lambert wrote:
The wadl2java tool does not seem to be able to
handle relative paths to
schemas. When I try to execute: mvn generate-sources
-X on a pom with the
following snippet:
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<!-- problem line.. note the elipses -->
<wadl:include href="../../common/faults-v1_***
__*0.xsd"/>
...
</wadl:grammers>
This exception stack is thrown:
[ERROR] Failed to execute goal
org.apache.cxf:cxf-wadl2java-***
__*plugin:2.5.2:wadl2java
(generate-sources)
on
project store-locator-rs-artifacts:
java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/**_**
_repository/com/dominos/**
ecommerce/schemas/0.0.1-**__**
SNAPSHOT/schemas-0.0.1-**
SNAPSHOT.jar!/services/store-***
__*locator/../../common/**faults-*__*v1_0.xsd
can not be read -> [Help 1]
org.apache.maven.lifecycle.**_**
_LifecycleExecutionException:
Failed to
execute
goal
org.apache.cxf:cxf-wadl2java-***
__*plugin:2.5.2:wadl2java
(generate-sources)
on project store-locator-rs-artifacts:
java.lang.RuntimeException:
Resource
jar:file:/home/lamberm/.m2/**_**
_repository/com/dominos/**
ecommerce/schemas/0.0.1-**__**
SNAPSHOT/schemas-0.0.1-**
SNAPSHOT.jar!/services/store-***
__*locator/../../common/**faults-*__*v1_0.xsd
can not be read
at
org.apache.maven.lifecycle.**_**
_internal.MojoExecutor.**execute(__**
MojoExecutor.java:217)
at
org.apache.maven.lifecycle.**_**
_internal.MojoExecutor.**execute(__**
MojoExecutor.java:153)
at
org.apache.maven.lifecycle.**_**
_internal.MojoExecutor.**execute(__**
MojoExecutor.java:145)
at
org.apache.maven.lifecycle.**_**_internal.**__**
LifecycleModuleBuilder.**
buildProject(**__**LifecycleModuleBuilder.java:****
__84)
at
org.apache.maven.lifecycle.**_**_internal.**__**
LifecycleModuleBuilder.**
buildProject(**__**LifecycleModuleBuilder.java:****
__59)
at
org.apache.maven.lifecycle.**_**
_internal.LifecycleStarter.**
singleThreadedBuild(**__**LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.**_**
_internal.LifecycleStarter.**
execute(LifecycleStarter.java:**__**161)
at
org.apache.maven.DefaultMaven.**
__**doExecute(DefaultMaven.**java:__**320)
at
org.apache.maven.DefaultMaven.**
__**execute(DefaultMaven.java:**__156)
at
org.apache.maven.cli.MavenCli.**
__**execute(MavenCli.java:537)
at
org.apache.maven.cli.MavenCli.**
__**doMain(MavenCli.java:196)
at
org.apache.maven.cli.MavenCli.**
__**main(MavenCli.java:141)
at
sun.reflect.**__**NativeMethodAccessorImpl.**__**
invoke0(Native
Method)
at
sun.reflect.**__**NativeMethodAccessorImpl.**__**
invoke(**
NativeMethodAccessorImpl.java:**__**57)
at
sun.reflect.**__**DelegatingMethodAccessorImpl.***
__*invoke(**
DelegatingMethodAccessorImpl.***__*java:43)
at java.lang.reflect.Method.**__**
invoke(Method.java:601)
at
org.codehaus.plexus.**__**
classworlds.launcher.Launcher.**__**
launchEnhanced(Launcher.java:***__*290)
at
org.codehaus.plexus.**__**
classworlds.launcher.Launcher.**__**
launch(Launcher.java:230)
at
org.codehaus.plexus.**__**
classworlds.launcher.Launcher.**__**
mainWithExitCode(Launcher.**__**java:409)
at
org.codehaus.plexus.**__**
classworlds.launcher.Launcher.**__**
main(Launcher.java:352)
Caused by:
org.apache.maven.plugin.**__**MojoExecutionException:
java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/**_**
_repository/com/dominos/**
ecommerce/schemas/0.0.1-**__**
SNAPSHOT/schemas-0.0.1-**
SNAPSHOT.jar!/services/store-***
__*locator/../../common/**faults-*__*v1_0.xsd
can not be read
at
org.apache.cxf.maven_plugin.****__wadlto.**__**
AbstractCodeGeneratorMojo.**
callCodeGenerator(**__**
AbstractCodeGeneratorMojo.**__**java:458)
at
org.apache.cxf.maven_plugin.****
__wadlto.WADL2JavaMojo.**execute(*__*
WADL2JavaMojo.java:101)
at
org.apache.maven.plugin.**__**
DefaultBuildPluginManager.**__**executeMojo(**
DefaultBuildPluginManager.**__**java:101)
at
org.apache.maven.lifecycle.**_**
_internal.MojoExecutor.**execute(__**
MojoExecutor.java:209)
... 19 more
Caused by:
org.apache.cxf.tools.common.****__ToolException:
java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/**_**
_repository/com/dominos/**
ecommerce/schemas/0.0.1-**__**
SNAPSHOT/schemas-0.0.1-**
SNAPSHOT.jar!/services/store-***
__*locator/../../common/**faults-*__*v1_0.xsd
can not be read
at
org.apache.cxf.tools.wadlto.****
__jaxrs.JAXRSContainer.**execute(*__*
JAXRSContainer.java:84)
at
org.apache.cxf.tools.common.****
__toolspec.ToolRunner.runTool(****
ToolRunner.java:103)
at
org.apache.cxf.tools.wadlto.****
__WADLToJava.run(WADLToJava.****__java:65)
at
org.apache.cxf.tools.wadlto.****
__WADLToJava.run(WADLToJava.****__java:57)
at
org.apache.cxf.maven_plugin.****__wadlto.**__**
AbstractCodeGeneratorMojo.**
callCodeGenerator(**__**
AbstractCodeGeneratorMojo.**__**java:455)
... 22 more
Caused by: java.lang.RuntimeException: Resource
jar:file:/home/lamberm/.m2/**_**
_repository/com/dominos/**
ecommerce/schemas/0.0.1-**__**
SNAPSHOT/schemas-0.0.1-**
SNAPSHOT.jar!/services/store-***
__*locator/../../common/**faults-*__*v1_0.xsd
can not be read
at
org.apache.cxf.jaxrs.ext.**__**
codegen.SourceGenerator.**
readIncludedDocument(**__**SourceGenerator.java:1174)
at
org.apache.cxf.jaxrs.ext.**__**
codegen.SourceGenerator.**__**getSchemaElements(**
SourceGenerator.java:1130)
at
org.apache.cxf.jaxrs.ext.**__**
codegen.SourceGenerator.**
generateSchemaCodeAndInfo(**__**
SourceGenerator.java:228)
at
org.apache.cxf.jaxrs.ext.**__**
codegen.SourceGenerator.**__**generateSource(**
SourceGenerator.java:220)
at
org.apache.cxf.tools.wadlto.****
__jaxrs.JAXRSContainer.**
processWadl(JAXRSContainer.**_**_java:153)
at
org.apache.cxf.tools.wadlto.****
__jaxrs.JAXRSContainer.**execute(*__*
JAXRSContainer.java:67)
at
org.apache.cxf.tools.wadlto.****
__jaxrs.JAXRSContainer.**execute(*__*
JAXRSContainer.java:76)
If I place the problemed schema in the same
directory as the wadl
everything behaves:
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<wadl:include href="faults-v1_0.xsd"/>
...
</wadl:grammers>
I am inlining the pom and wadl in case the list has
problems with
attachments. I hope that is okay. Am I doing
something wrong?
Thank you in Advance.
----
<project
xmlns="http://maven.apache.**_**_org/POM/4.0.0<
http://maven.__**apache.org/POM/4.0.0<http://apache.org/POM/4.0.0>
<http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
"
xmlns:xsi="
http://www.w3.org/2001/**__**XMLSchema-instance<http://www.w3.org/2001/**__XMLSchema-instance>
<http://www.w3.org/2001/****XMLSchema-instance<http://www.w3.org/2001/**XMLSchema-instance>
<http://**www.<http://www.>__w3.org/2001/XMLSchema-**instance<http://w3.org/2001/XMLSchema-instance>
<http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
__>"
xsi:schemaLocation="
http://maven.apache.org/POM/4.**__**0.0<http://maven.apache.org/POM/4.__**0.0>
<http://maven.apache.org/POM/**4.**0.0<http://maven.apache.org/POM/4.**0.0>
<http://maven.apache.**org/__POM/4.0.0<http://maven.apache.org/__POM/4.0.0>
<http://maven.apache.org/POM/**4.0.0<http://maven.apache.org/POM/4.0.0>
http://maven.apache.org/xsd/****__maven-4.0.0.xsd<http://maven.apache.org/xsd/**__maven-4.0.0.xsd>
<http://maven.apache.org/xsd/****maven-4.0.0.xsd<http://maven.apache.org/xsd/**maven-4.0.0.xsd>
<http://**maven.<http://maven.>__apache.org/xsd/maven-**4.0.0.xsd<http://apache.org/xsd/maven-4.0.0.xsd>
<http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
__>
">
<modelVersion>4.0.0</**__**modelVersion>
<artifactId>store-locator-rs-***
__*artifacts</artifactId>
<version>0.0.1-SNAPSHOT</**__**version>
<parent>
<artifactId>api-maven-base</****__artifactId>
<groupId>com.acme.ecommerce</***__*groupId>
<version>0.1.4</version>
</parent>
<dependencies>
<dependency>
<groupId>com.acme.ecommerce</***__*groupId>
<artifactId>schemas</**__**artifactId>
<version>0.0.1-SNAPSHOT</**__**version>
</dependency>
<dependency>
<groupId>org.apache.cxf</**__**groupId>
<artifactId>cxf-bundle-jaxrs</**__**artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</**__**groupId>
<artifactId>cxf-wadl2java-**__**plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</**__**phase>
<configuration>
<sourceRoot>${basedir}/target/**
__**generated/src/main/java</****__sourceRoot>
<wadlOptions>
<wadlOption>
<wadl>classpath:/services/**__**
store-locator/store-locator-**
wadl-v1.xml</wadl>
<extraargs>
<extraarg>-verbose</extraarg>
</extraargs>
<packagename>com.acme.**__**
ecommerce.store.locator.**__**service.rs.version1</**
packagename>
<schemaPackagenames>
<schemaPackagename>urn:com:**_**
_acme:ecommerce:wadl:store-**
locator:v1=com.acme.ecommerce.**
__**store.locator.service.rs.****
version1</schemaPackagename>
<schemaPackagename>urn:com:**_**
_acme:ecommerce:schema:store-****
locator:v1=com.acme.ecommerce.**
__**store.locator.service.rs.****
version1</schemaPackagename>
</schemaPackagenames>
</wadlOption>
</wadlOptions>
</configuration>
<goals>
<goal>wadl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store
Eclipse m2e settings
only.
It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</**__**groupId>
<artifactId>lifecycle-mapping<**__**/artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.cxf
</groupId>
<artifactId>
cxf-wadl2java-plugin
</artifactId>
<versionRange>
[2.5.1,)
</versionRange>
<goals>
<goal>wadl2java</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
----
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<wadl:application
xmlns="urn:com:acme:ecommerce:**
__**wadl:store-locator:v1"
targetNamespace="urn:com:acme:**
__**ecommerce:wadl:store-__**locator:**v1"
xmlns:xsd="http://www.w3.org/***__*2001/XMLSchema<http://www.w3.org/*__*2001/XMLSchema>
<http://www.w3.org/**2001/**XMLSchema<http://www.w3.org/**2001/XMLSchema>
<http://www.w3.__**org/2001/XMLSchema
<http://www.w3.org/2001/**XMLSchema<http://www.w3.org/2001/XMLSchema>
"
xmlns:store-locator-v1="urn:****
__com:acme:ecommerce:schema:**
store-locator:v1"
xmlns:wadl="http://wadl.dev.****__java.net/2009/02
<http://java.net/2009/02><http**://wadl.<http://wadl.>
__dev.java.net/2009/02
<http://wadl.dev.java.net/**2009/02<http://wadl.dev.java.net/2009/02>
">
<wadl:doc xml:lang="en" title="Version 1.0"/>
<wadl:grammars>
<wadl:include href="store-locator-v1.xsd"/>
<wadl:include href="../../common/faults-v1_***
__*0.xsd"/>
<xsd:schema
xmlns="urn:com:acme:ecommerce:**
__**wadl:store-locator:v1"
targetNamespace="urn:com:acme:**
__**ecommerce:wadl:store-__**locator:**v1">
<xsd:simpleType name="**__**
StoreLocatorQueryEnumType">
<xsd:restriction base="xsd:normalizedString">
<xsd:enumeration value="find_by_geocode"/>
<xsd:enumeration value="find_by_address"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
</wadl:grammars>
<wadl:resources
base="http://store-locator.**a**__cme.com<http://a__cme.com>
<http://acme.com><http://**store-locator.<http://store-locator.>
__acme.com
<http://store-locator.acme.com**>>
">
<wadl:resource path="/store" id="StoreLocator">
<wadl:method href="#findByQuery"/>
</wadl:resource>
</wadl:resources>
<wadl:method name="GET" id="findByQuery">
<wadl:request>
<wadl:doc xml:lang="en" title="Find by query
parameters. Valid queries are
'find by geocode' and 'find by geographic address'"/>
<!-- query name -->
<wadl:param name="q" style="query"
type="**__**StoreLocatorQueryEnumType"
required="true" />
<!-- geocode -->
<wadl:param name="latitude" style="query"
type="xsd:double"
required="false" />
<wadl:param name="longitude" style="query"
type="xsd:double"
required="false" />
<!-- geographic address -->
<wadl:param name="address_line_1" style="query"
required="false" />
<wadl:param name="address_line_2" style="query"
required="false" />
<wadl:param name="address_line_3" style="query"
required="false" />
<wadl:param name="city" style="query"
required="false" />
<wadl:param name="region" style="query"
required="false" />
<wadl:param name="postal_code" style="query"
required="false" />
<wadl:param name="country" style="query"
required="false" />
</wadl:request>
<wadl:response>
<wadl:representation status="200"
mediaType="application/vnd.**_**
_com.acme.ecommerce.store-**
locator-result+json;version=1.**__**0"
element="store-locator-v1:**__**
StoreLocatorResultList"/>
<!--
<wadl:fault id="BadOrMissingValue" status="400"
mediaType="application/vnd.**_**
_com.acme.ecommerce.common+**
json;version=1.0"
element="faults-v1_0:**__**ValidationFault"/>
<wadl:fault id="NotAuthorized" status="403"
mediaType="application/vnd.**_**
_com.acme.ecommerce.common+**
json;version=1.0"
element="faults-v1_0:**__**NotAuthorizedFault"/>
<wadl:fault id="NotFound" status="404"
mediaType="application/vnd.**_**
_com.acme.ecommerce.common+**
json;version=1.0"
element="faults-v1_0:**__**NoEntityFoundFault"/>
<wadl:fault id="CanNotPerform" status="500"
mediaType="application/vnd.**_**
_com.acme.ecommerce.common+**
json;version=1.0"
element="faults-v1_0:**__**CanNotPerformFault"/>
-->
</wadl:response>
</wadl:method>
</wadl:application>
----
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com