0

The configuration below works perfectly when I build my project using the command mvn clean package, but when I run the same command on Jenkins it produces an error message (bottom). I've tried to reconfigure by changing <configuration> without any luck.

<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)

2 Answers 2

1

The code below resolved the issue. Apparently Jenkins is not comfortable with the contents of <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>
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.