mercredi 5 août 2015

Maven 4.0.0 Swagger 1.3.12 build fails


I'm trying to get maven to build with swagger. But I get this error:

Failed to execute goal com.github.kongchen:swagger-maven-plugin:2.3.4:generate (default) on project web: Execution default of goal com.github.kongchen:swagger-maven-plugin:2.3.4:generate failed: An API incompatibility was encountered while executing com.github.kongchen:swagger-maven-plugin:2.3.4:generate: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/LockModeType

The pom.xml dependency:

    <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-annotations</artifactId>
        <scope>compile</scope>
        <version>1.3.12</version>
        <exclusions>
            <exclusion>
                <groupId>javax.ws.rs</groupId>
                <artifactId>jsr311-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

The pom.xml Plugin:

<plugin>
            <groupId>com.github.kongchen</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>2.3.4</version>
            <configuration>
                <apiSources>
                    <apiSource>
                        <supportSpringMvc>false</supportSpringMvc>
                        <locations>package.rest</locations>
                        <apiVersion>0.1</apiVersion>
                        <basePath>/api</basePath>
                        <outputTemplate>${basedir}/swaggerTempl/strapdown.html.mustache</outputTemplate>
                        <mustacheFileRoot>${basedir}/swaggerTempl</mustacheFileRoot>
                        <outputPath>${project.build.directory}/swaggerFolder/document.html</outputPath>
                        <swaggerDirectory>${project.build.directory}/swaggerFolder</swaggerDirectory>
                    </apiSource>
                </apiSources>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Can anyone help me? What do I have to change to build it correctly? Do I have to install swagger on my PC? These folders don't exist, do I have to create them or should maven/swagger do it automatically?:

${basedir}/swaggerTempl/strapdown.html.mustache

${basedir}/swaggerTempl



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire