scalaxb and maven

79 views
Skip to first unread message

Paulo "JCranky" Siqueira

unread,
May 24, 2012, 12:10:43 PM5/24/12
to sca...@googlegroups.com
Hi,

Again regarding the mvn scalaxb plugin, a question: Is it possible to generate code in different packages, for different sets of xsd files?

[]s,

--
Paulo "JCranky" Siqueira
Visit my blog: http://www.jcranky.com/

eugene yokota

unread,
May 24, 2012, 12:19:00 PM5/24/12
to sca...@googlegroups.com
scalaxb-mvn-plugin supports all parameters available to sbt-scalaxb.

/**
* Map of namespace URIs to package names for generated classes.
* <br/>
* This option can be used to override the <code>packageName</code>
* parameter (see above) for elements in specific namespaces. The mapping
* between namespace URIs and package names can be specifying any number of
* <code>packageName</code> elements within the <code>packageNames</code>
* element. For example:
* <pre>
* &lt;packageNames&gt;
* &lt;packageName&gt;
* &lt;uri&gt;http://example.com/service1&lt;/uri&gt;
* &lt;package&gt;com.example.service1&lt;package&gt;
* &lt;/packageName&gt;
* &lt;packageName&gt;
* &lt;uri&gt;http://example.com/service2&lt;/uri&gt;
* &lt;package&gt;com.example.service2&lt;package&gt;
* &lt;/packageName&gt;
* &lt;/packageNames&gt;
* </pre>
* @parameter
*/
private PackageName[] packageNames;

-eugene

Martin Ellis

unread,
May 24, 2012, 1:13:27 PM5/24/12
to sca...@googlegroups.com
What he said. :)

Also, the pretty-printed docs can be found here:
http://martiell.github.com/scalaxb/maven/generate-mojo.html

Martin

Paulo "JCranky" Siqueira

unread,
May 25, 2012, 6:10:18 PM5/25/12
to sca...@googlegroups.com
Thanks. Still my doubt persists. Can I have two xsdDirectory, each one pointing at a different packageName?

[]s,

2012/5/24 Martin Ellis <mar...@ellis.name>

Martin Ellis

unread,
May 25, 2012, 7:28:41 PM5/25/12
to sca...@googlegroups.com
I haven't tested it, but I think this should work:

<plugin>
<groupId>org.scalaxb</groupId>
<artifactId>scalaxb-maven-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<id>scalaxb-foo</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<packageName>foo</packageName>
<xsdDirectory>src/main/foo</xsdDirectory>
</configuration>
</execution>
<execution>
<id>scalaxb-bar</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<packageName>bar</packageName>
<xsdDirectory>src/main/bar</xsdDirectory>
</configuration>
</execution>
</executions>
</plugin>

Does that do what you need?

Martin

Paulo "JCranky" Siqueira

unread,
Jun 1, 2012, 11:10:45 AM6/1/12
to sca...@googlegroups.com
Wow, thanks! Works like a charm =)

[]s,

2012/5/25 Martin Ellis <mar...@ellis.name>

Martin Ellis

unread,
Jun 1, 2012, 11:24:11 AM6/1/12
to sca...@googlegroups.com
Excellent! Thanks for letting me know. :o)

Martin
Reply all
Reply to author
Forward
0 new messages