• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • maven-plugin
    • OS name: "linux", version: "2.6.32-504.12.2.el6.x86_64", arch: "amd64", family: "unix"
      Apache Maven 3.3.3
      Java version: 1.7.0_91
      Jenkins versinon: 1.631

      We are trying to build a maven project where we use the jaxb2-maven-plugin (version 1.4) to generate java classes from some xsd files.

      The configuration of one execution looks like this :
      <execution>
      <id>executionA</id>
      <configuration>
      <schemaDirectory>src/main/resources</schemaDirectory>
      <schemaFiles>path/A.xsd</schemaFiles>
      <packageName>package.info.name</packageName>
      <staleFile>target/generated-sources/A.jaxb</staleFile>
      <bindingFiles>A.xjb</bindingFiles>
      </configuration>
      <goals>
      <goal>xjc</goal>
      </goals>
      </execution>

      We have, therefore, a A.xjb binding file which is placed in the default 'src/main/xjb' folder and which specifies some bindings
      for instance :
      <?xml version="1.0" encoding="UTF-8"?>
      <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jxb:extensionBindingPrefixes="xjc">
      <jxb:globalBindings>
      <xjc:simple />
      <xjc:serializable uid="1" />
      ...
      </jxb:globalBindings>

      <jxb:bindings schemaLocation="../path/A.xsd" node="/xs:schema">
      <jxb:schemaBindings>
      ...
      </jxb:schemaBindings>
      <jxb:bindings node="//xs:element[@name = 'XXX']">
      ...
      </jxb:bindings>
      ...
      </jxb:bindings>
      </jxb:bindings>

      The following error occurs when the build is executed on Jenkins :
      [INFO] — jaxb2-maven-plugin:1.4:xjc (executionA) @ schemas —
      [INFO] Generating source...
      [INFO] parsing a schema...
      [ERROR] file:/opt/home/diojenkins/workspace/project/schemas/src/main/xjb/A.xjb[12,118]
      com.sun.istack.SAXParseException2; systemId: file:/opt/home/diojenkins/workspace/project/schemas/src/main/xjb/A.xjb; lineNumber: 12; columnNumber: 118; "file:/opt/home/diojenkins/workspace/project/schemas/src/main/path/A.xsd" is not a part of this compilation. Is this a mistake for "file:/home/diojenkins/workspace/project/schemas/src/main/path/A.xsd"?
      at com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:598)
      at com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:592)
      at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:246)
      at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:375)
      at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:136)
      at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:98)
      at com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:447)
      at com.sun.tools.xjc.ModelLoader.buildDOMForest(ModelLoader.java:342)
      at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:374)
      at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167)
      at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:113)
      at com.sun.tools.xjc.Driver.run(Driver.java:313)
      at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:314)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      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:116)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
      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:606)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
      at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
      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:606)
      at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
      at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
      at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      at hudson.remoting.Request$2.run(Request.java:326)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
      [INFO] Failed to parse a schema.

      You may need to know that there exists a symbolic link between the /opt/home/diojenkins and /home/diojenkins so they are the same.

      The error occurs only when the build is executed on Jenkins, if we build it in the jenkins workspace with the same options it works just fine.

      Can anyone help us ?

          [JENKINS-32185] jaxb2-maven-plugin:1.4:xjc error

          Oleg Nenashev added a comment -

          Are you sure you use the similar Maven versions within Jenkins and outside Jenkins?

          Oleg Nenashev added a comment - Are you sure you use the similar Maven versions within Jenkins and outside Jenkins?

          Yes, it is.
          A work around to make it work has been found :
          We specify the full path of the pom.xml in the configuration > build > root pom.

          So it seems that while the build is done through jenkins, mvn fails to build because of the symbolic link.
          While when outside of jenkins, mvn takes the correct path for the pom.

          Gaetan Reyners added a comment - Yes, it is. A work around to make it work has been found : We specify the full path of the pom.xml in the configuration > build > root pom. So it seems that while the build is done through jenkins, mvn fails to build because of the symbolic link. While when outside of jenkins, mvn takes the correct path for the pom.

          Oleg Nenashev added a comment -

          Passing the issue to Maven plugin owners for the further analysis.

          Oleg Nenashev added a comment - Passing the issue to Maven plugin owners for the further analysis.

          greyners Could you provide us a little project sample to reproduce it ?

          Arnaud Héritier added a comment - greyners Could you provide us a little project sample to reproduce it ?

            Unassigned Unassigned
            greyners Gaetan Reyners
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: