Question

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)
Was it helpful?

Solution

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>

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top