2017-02-27 190 views
0

我在使用mvn clean install構建項目時收到XJC(從XSD生成源)錯誤。奇怪的是,當在其他機器中構建相同的代碼時,同樣的代碼獲得成功並且源自XSD生成。以下是我得到的例外情況。maven乾淨安裝失敗,XJC錯誤

Downloaded: https://repo.maven.apache.org/maven2/com/sun/xml/bind/jaxb-xjc/2.1.13/jaxb-xjc-2.1.13.jar (3031 KB at 27.0 KB/sec) 
[INFO] Generating source... 
[INFO] parsing a schema... 
[ERROR] file:/home/proj-app/message-converter/msg-cnvrtr-domain/src/main/resources/MSG-CNVRTR-DB.xsd[133,60] 
org.xml.sax.SAXParseException; systemId: file:/home/proj-app/message-converter/proj-domain/src/main/resources/MSG-CNVRTR-DB.xsd; lineNumber: 133; columnNumber: 60; src-resolve: Cannot resolve the name 'msg:ChannelType' to a(n) 'type definition' component. 
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) 
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) 
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4156) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4139) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1745) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:405) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:194) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:3612) 
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:636) 
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:613) 
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:572) 
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:538) 
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255) 
at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:101) 
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:357) 
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167) 

我想這是我的環境設置的一些問題,因爲在其他機器編譯也是如此。任何人都可以對此有所瞭解嗎?

+0

請提供一些背景信息。 (java版本,操作系統,項目機器上使用的編碼,...) –

+0

嗨,請在下面找到詳細信息: JDK:1.8.0_121(Open JDK) Maven :3.2.5 操作系統:Ubuntu(xenial) – ArunavaS

+0

請同時附上pom.xml文件內容 –

回答

0

下面是構建部分從pom.xml的

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>jaxb2-maven-plugin</artifactId> 
      <version>1.5</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>xjc</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <schemaDirectory> 
        ${project.basedir}/src/main/resources 
       </schemaDirectory> 
       <bindingDirectory>${project.basedir}/src/main/resources</bindingDirectory> 
       <bindingFiles>CredSubTypeBinding.xjb</bindingFiles> 
       <generateDirectory> 
        ${project.basedir}/src/main/java 
       </generateDirectory> 
       <arguments>-extension -npa -b ${project.basedir}/src/main/resources/global.xjb</arguments> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-source-plugin</artifactId> 
      <executions> 
      <execution> 
       <id>attach-sources</id> 
       <goals> 
       <goal>jar</goal> 
       </goals> 
      </execution> 
      </executions> 
     </plugin>   
    </plugins> 
</build>