use*_*178 14 build jaxb xjc maven
我已将以下插件添加到pom.xml中的Maven构建中
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<extension>true</extension>
<clearOutputDir>false</clearOutputDir>
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<schemaFiles>myapp.xsd</schemaFiles>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<bindingDirectory>src/main/resources/xsd</bindingDirectory>
<bindingFiles>myapp-bindings.xjb</bindingFiles>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
以下是构建错误.
[INFO] Ignored given or default xjbSources [C:\WorkSpace\MyApp\src\main\xjb], since it is not an existent file or directory.
[INFO] Ignored given or default sources [C:\WorkSpace\MyApp\src\main\xsd], since it is not an existent file or directory.
[WARNING] No XSD files found. Please check your plugin configuration.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.273s
[INFO] Finished at: Tue May 12 16:24:26 EDT 2015
[INFO] Final Memory: 9M/124M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "dev-artifactory" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.1:xjc (default) on project pml-jasypt-authentication-service: MojoExecutionException: NoSchemasException -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
我很困惑,为什么插件没有引用配置中指定的路径和文件.
Dav*_*ick 15
版本2.1已更改了指定源的方式
http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html#sources
例如
<configuration>
...
<sources>
<source>some/explicit/relative/file.xsd</source>
<source>/another/absolute/path/to/a/specification.xsd</source>
<source>a/directory/holding/xsds</source>
</sources>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我有一整个其他问题的世界所以坚持使用1.6,因为jshark建议这是一个很好的计划
版本2.1有一个错误.
您可以使用<version>2.2</version>
新语法:
<configuration>
...
<sources>
<source>some/explicit/relative/file.xsd</source>
<source>/another/absolute/path/to/a/specification.xsd</source>
<source>a/directory/holding/xsds</source>
</sources>
</configuration>
Run Code Online (Sandbox Code Playgroud)
您可以使用<version>1.6</version>
旧语法:
<configuration>
...
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<schemaFiles>myapp.xsd</schemaFiles>
</configuration>
Run Code Online (Sandbox Code Playgroud)
小智 5
我今天遇到了同样的问题,并通过以下方式解决了它:
<version>1.6</version>
Run Code Online (Sandbox Code Playgroud)
关于插件定义(这通常是好的做法)
归档时间: |
|
查看次数: |
39229 次 |
最近记录: |