[
https://issues.apache.org/jira/browse/TAVERNA-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16442414#comment-16442414
]
Stian Soiland-Reyes edited comment on TAVERNA-1041 at 4/18/18 12:27 PM:
------------------------------------------------------------------------
Using [cxf-xjc-plugin|http://cxf.apache.org/cxf-xjc-plugin.html] instead seems
to work. It is a bit different configuration, so I changed that in
taverna-language.
Note that [http://cxf.apache.org/cxf-xjc-plugin.html] is quite out of date, the
latest version is 3.2.1 and there is a very useful option {{<xsdDir>}} to
process a full directory. We need to use {{{$project.basedir}/}} in the paths
to ensure the build works in multi-module projects.
Taverna Language has not currently got much consistency in where the XSDs live,
and in how they define their namespaces. Some use bindings.xjb, some use JAXB
annotations inline in the XSD, and some use parameters to xjc in pom.xml. One
variation is also if the XSDs are in src/main/resources (to be in JAR
classpath) or src/main/xsd – the first is preferable for our own XSDs, and the
second is preferable for third-party XSDs of non-AL licenses.
So I have mainly kept the same structure. See
[https://github.com/apache/incubator-taverna-language/compare/4224fb082ac206f0a69af1f5ee836ca92e5a35a8...97052ae2884631a81a0e1771a1d39e6a8cb5bb70]
for details.
Rough (combined) example:
{code:java}
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<sourceRoot>${basedir}/target/generated-sources/cxf-xjc</sourceRoot>
<xsdOptions>
<xsdOption>
<!-- single file (and its imports) go to fixed packagename -->
<xsd>${project.basedir}/src/main/resources/xsd/baclava.xsd</xsd>
<packagename>org.apache.taverna.baclava</packagename>
</xsdOption>
<xsdOption>
<xsdDir>${project.basedir}/src/main/xsd</xsdDir>
<!-- mapping to package name given in binding.xjb -->
<bindingFile>${project.basedir}/src/main/xsd/binding.xjb</bindingFile>
</xsdOption>
<xsdOption>
<!-- XSD files declare their package names with JAXB annotations -->
<xsdDir>${project.basedir}/src/main/resources/org/apache/taverna/scufl2/rdfxml/xsd/</xsdDir>
</xsdOption>
</xsdOptions>
</configuration>
<executions>
<execution>
<goals>
<goal>xsdtojava</goal>
</goals>
</execution>
</executions>
</plugin>{code}
was (Author: stain):
Using [cxf-xjc-plugin|http://cxf.apache.org/cxf-xjc-plugin.html] instead seems
to work. It is a bit different configuration, so I changed that in
taverna-language.
Note that [http://cxf.apache.org/cxf-xjc-plugin.html] is quite out of date, the
latest version is 3.2.1 and there is a very useful option {{<xsdDir>}} to
process a full directory. We need to use \{{{$project.basedir}/}} in the paths
to ensure the build works in multi-module projects.
Taverna Language has not currently got much consistency in where the XSDs live,
and in how they define their namespaces. Some use bindings.xjb, some use JAXB
annotations inline in the XSD, and some use parameters to xjc in pom.xml. One
variation is also if the XSDs are in src/main/resources (to be in JAR
classpath) or src/main/xsd – the first is preferable for our own XSDs, and the
second is preferable for third-party XSDs of non-AL licenses.
So I have mainly kept the same structure. See
[https://github.com/apache/incubator-taverna-language/compare/4224fb082ac206f0a69af1f5ee836ca92e5a35a8...97052ae2884631a81a0e1771a1d39e6a8cb5bb70]
for details.
Rough (combined) example:
{code:java}
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<sourceRoot>${basedir}/target/generated-sources/cxf-xjc</sourceRoot>
<xsdOptions>
<xsdOption>
<!-- single file (and its imports) go to fixed packagename -->
<xsd>${project.basedir}/src/main/resources/xsd/baclava.xsd</xsd>
<packagename>org.apache.taverna.baclava</packagename>
</xsdOption>
<xsdOption>
<xsdDir>${project.basedir}/src/main/xsd</xsdDir>
<!-- mapping to package name given in binding.xjb -->
<bindingFile>${project.basedir}/src/main/xsd/binding.xjb</bindingFile>
</xsdOption>
<xsdOption>
<!-- XSD files declare their package names with JAXB annotations -->
<xsdDir>${project.basedir}/src/main/resources/org/apache/taverna/scufl2/rdfxml/xsd/</xsdDir>
</xsdOption>
</xsdOptions>
</configuration>
<executions>
<execution>
<goals>
<goal>xsdtojava</goal>
</goals>
</execution>
</executions>
</plugin>{code}
+ <version>3.2.1</version>
> Java 9 support: replace maven-jaxb2-plugin?
> -------------------------------------------
>
> Key: TAVERNA-1041
> URL: https://issues.apache.org/jira/browse/TAVERNA-1041
> Project: Apache Taverna
> Issue Type: Bug
> Components: Taverna Language, Taverna OSGi, Taverna Plugin
> Component, Taverna Server
> Environment: JDK 9
> Reporter: Stian Soiland-Reyes
> Assignee: Stian Soiland-Reyes
> Priority: Major
>
> It would be good if our project can compile (and not just run) with Java 9.
> This might require updating/replacing some Maven plugins. I ran into an issue
> with maven-jaxb2-plugin when [compiling taverna-language on
> JDK9|https://builds.apache.org/user/stain/my-views/view/taverna/job/incubator-taverna-language/469/console].
> {{[ERROR] Failed to execute goal
> org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.3:generate (default) on
> project taverna-baclava-language: Execution default of goal
> org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.3:generate failed: Prefix ''
> is already bound to '' -> [Help 1]}}
> It seems maven-jaxb2-plugin is [still working on Java 9
> support|https://github.com/highsource/maven-jaxb2-plugin/issues/114], in
> particular an issue with setting [package
> names|https://github.com/highsource/maven-jaxb2-plugin/issues/120], which
> probably would affect us.
> This issue will investigate if there are workarounds for the current release
> of maven-jaxb2-plugin or if we should switch to alternatives like Apache
> [cxf-xjc-plugin|http://cxf.apache.org/cxf-xjc-plugin.html]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)