0

当我使用命令构建我的项目时,下面的配置完美mvn clean package运行,但是当我在 Jenkins 上运行相同的命令时,它会产生错误消息(底部)。我试图通过更改来重新配置,<configuration>但没有任何运气。

<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>
                <arguments>-extension -npa -b ${project.basedir}/src/main/xsd/global.xjb</arguments> 
            </configuration>
        </plugin>
    </plugins>
</build>


Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc (default) on project xxx: unrecognized parameter -
cause : unrecognized parameter -
Stack trace : 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc (default) on project xxx: unrecognized parameter -
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
4

2 回答 2

1

下面的代码解决了这个问题。显然 Jenkins 对 <arguments>.

<configuration>
    <extension>true</extension>
    <npa>true</npa>
    <bindingDirectory>${project.basedir}/src/main/xsd/</bindingDirectory>
    <bindingFiles>global.xjb</bindingFiles>
    <schemaDirectory>${project.basedir}/src/main/xsd/</schemaDirectory>
    <schemaFiles>*.xsd</schemaFiles>
</configuration>
于 2013-05-07T22:43:50.697 回答
1

We encountered the very same problem when Jenkins job name included spaces and dash. Xjc was supplied with a directory name like "blahblah - blahblah", but unquotated, so it recognized "-" as an parameter (or almost a parameter).

Changing configuration worked as well as renaming a job.

于 2015-05-21T09:04:30.150 回答