Hi Mike -
thanks for the test - I'll look asap,
Cheers, Sergey
On 09/04/13 19:25, Michael Lambert wrote:
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:[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>
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://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>__>"
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/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>__>
">
<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>>
"
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.__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://acme.com><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