2

我正在尝试使用swagger-codegen-maven-plugin生成文档

但我得到一个错误。我的 pom 是

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.aepona.monetization</groupId>
    <artifactId>com.aepona.monetization</artifactId>
    <name>Aepona monetization Engine</name>
    <version>0.1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <java.version>1.8</java.version>
        <main.basedir>${basedir}/../..</main.basedir>
        <maven.enforcer.plugin.version>1.0.1</maven.enforcer.plugin.version>
        <maven.surefire.plugin.version>2.18.1</maven.surefire.plugin.version>

        <slf4j-api.version>1.7.22</slf4j-api.version>
        <logback.version>1.2.2</logback.version>
        <spring-security.version>4.2.1.RELEASE</spring-security.version>
        <jmockit.version>1.30</jmockit.version>
        <spring-core.version>4.3.4.RELEASE</spring-core.version>
        <spring-integration-core.version>4.3.5.RELEASE</spring-integration-core.version>
        <spring-integration-kafka.version>1.0.0.RELEASE</spring-integration-kafka.version>
        <spring-data-couchbase.version>3.0.0.M1</spring-data-couchbase.version>
        <jmh.version>1.17.4</jmh.version>
        <dbunit.version>2.5.1</dbunit.version>
        <spring-test.version>4.3.0.RELEASE</spring-test.version>
        <junit.version>4.12</junit.version>
        <spark-core_2.10.version>2.0.1</spark-core_2.10.version>
        <javax.ws.rs-api.version>2.0.1</javax.ws.rs-api.version>
        <commons-lang3.version>3.5</commons-lang3.version>
        <jersey-common.version>2.22.2</jersey-common.version>
        <jackson-databind.version>2.6.5</jackson-databind.version>
        <java-client.version>2.4.1</java-client.version>
        <spark-connector_2.10.version>2.0.0</spark-connector_2.10.version>
        <wadl-core.version>1.1.6</wadl-core.version>
        <quartz.version>2.2.3</quartz.version>
        <aws-java-sdk.version>1.11.70</aws-java-sdk.version>
        <disruptor.version>3.3.6</disruptor.version>
        <spring-boot-starter-tomcat.version>1.5.1.RELEASE</spring-boot-starter-tomcat.version>
        <spring-boot-starter-web.version>1.5.1.RELEASE</spring-boot-starter-web.version>
        <spring-boot-starter-batch.version>1.5.1.RELEASE</spring-boot-starter-batch.version>
        <spring-batch-integration.version>3.0.7.RELEASE</spring-batch-integration.version>
        <spring-batch-infrastructure.version>4.0.0.M1</spring-batch-infrastructure.version>
        <spring-ws-core.version>2.4.0.RELEASE</spring-ws-core.version>
        <json-path.version>2.2.0</json-path.version>
        <hsqldb.version>2.3.4</hsqldb.version>
        <json.version>20160810</json.version>
        <hamcrest-all.version>1.3</hamcrest-all.version>
        <spring-boot-starter-test.version>1.5.1.RELEASE</spring-boot-starter-test.version>
        <mockito-all.version>2.0.2-beta</mockito-all.version>
        <validation-api.version>1.0.0.GA</validation-api.version>
        <hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
        <groovy-all.version>2.4.8</groovy-all.version>
        <ical4j.version>0.9.20</ical4j.version>
        <google-rfc-2445.version>20110304</google-rfc-2445.version>
        <joda-time.version>2.9.7</joda-time.version>
        <swagger-springmvc.version>1.0.2</swagger-springmvc.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
    </parent>

    <dependencyManagement>
        <dependencies>

            <!--Spring Core-->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>${spring-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-batch</artifactId>
                <version>${spring-boot-starter-batch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.batch</groupId>
                <artifactId>spring-batch-integration</artifactId>
                <version>${spring-batch-integration.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-core</artifactId>
                <version>${spring-integration-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-xml</artifactId>
                <version>${spring-integration-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-file</artifactId>
                <version>${spring-integration-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-kafka</artifactId>
                <version>${spring-integration-kafka.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.integration</groupId>
                <artifactId>spring-integration-stream</artifactId>
                <version>${spring-integration-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.batch</groupId>
                <artifactId>spring-batch-infrastructure</artifactId>
                <version>${spring-batch-infrastructure.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-couchbase</artifactId>
                <version>${spring-data-couchbase.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-oxm</artifactId>
                <version>${spring-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ws</groupId>
                <artifactId>spring-ws-core</artifactId>
                <version>${spring-ws-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>${spring-boot-starter-web.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <version>${spring-boot-starter-tomcat.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
                <version>${spring-security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${spring-security.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${spring-security.version}</version>
            </dependency>

            <!--Commons and libs-->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <version>${json-path.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.core</groupId>
                <artifactId>jersey-common</artifactId>
                <version>${jersey-common.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>
            <dependency>
                <groupId>net.jcip</groupId>
                <artifactId>jcip-annotations</artifactId>
                <version>RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>${groovy-all.version}</version>
            </dependency>


            <!--Logging-->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>

            <!--CouchDB-->
            <dependency>
                <groupId>com.couchbase.client</groupId>
                <artifactId>java-client</artifactId>
                <version>${java-client.version}</version>
            </dependency>
            <dependency>
                <groupId>com.couchbase.client</groupId>
                <artifactId>spark-connector_2.10</artifactId>
                <version>${spark-connector_2.10.version}</version>
            </dependency>

            <!--javax -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>4.0.0-b01</version>
            </dependency>
            <dependency>
                <groupId>org.jvnet.ws.wadl</groupId>
                <artifactId>wadl-core</artifactId>
                <version>${wadl-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jvnet.ws.wadl</groupId>
                <artifactId>wadl-client-plugin</artifactId>
                <version>${wadl-core.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>1</version>
            </dependency>
            <dependency>
                <groupId>javax.ws.rs</groupId>
                <artifactId>javax.ws.rs-api</artifactId>
                <version>${javax.ws.rs-api.version}</version>
            </dependency>

            <!--Quartz scheduler-->
            <dependency>
                <groupId>org.quartz-scheduler</groupId>
                <artifactId>quartz</artifactId>
                <version>${quartz.version}</version>
            </dependency>

            <!--hsqldb-->
            <dependency>
                <groupId>org.hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <version>${hsqldb.version}</version>
            </dependency>
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${json.version}</version>
            </dependency>

            <!--AWS-->
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk</artifactId>
                <version>${aws-java-sdk.version}</version>
            </dependency>

            <!--Disruptor-->
            <dependency>
                <groupId>com.lmax</groupId>
                <artifactId>disruptor</artifactId>
                <version>${disruptor.version}</version>
            </dependency>

            <!--Spark-->
            <dependency>
                <groupId>org.apache.spark</groupId>
                <artifactId>spark-core_2.10</artifactId>
                <version>${spark-core_2.10.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!--Test Frameworks-->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring-test.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jmockit</groupId>
                <artifactId>jmockit</artifactId>
                <version>${jmockit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>${hamcrest-all.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.dbunit</groupId>
                <artifactId>dbunit</artifactId>
                <version>${dbunit.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <artifactId>junit</artifactId>
                        <groupId>junit</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-core</artifactId>
                <version>${jmh.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-generator-annprocess</artifactId>
                <version>${jmh.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockito-all.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring-boot-starter-test.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${validation-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${hibernate-validator.version}</version>
            </dependency>
            <dependency>
                <groupId>ical4j</groupId>
                <artifactId>ical4j</artifactId>
                <version>${ical4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-saddle</groupId>
                <artifactId>google-rfc-2445</artifactId>
                <version>${google-rfc-2445.version}</version>
            </dependency>
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>${joda-time.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>2.6.1</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/io.swagger/swagger-codegen-maven-plugin -->
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.2.2</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <modules>
        <module>api</module>
        <module>core</module>
        <module>input-processing</module>
        <module>pre-processing</module>
        <module>settlement</module>
        <module>reporting</module>
        <module>docs</module>
        <module>release</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven.enforcer.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.2.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>/data/ame.yaml</inputSpec>
                            <language>java</language>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.7</version>
                <configuration>
                    <targetJdk>1.8</targetJdk>
                    <failOnViolation>true</failOnViolation>
                    <outputDirectory>target</outputDirectory>
                    <rulesets>
                        <ruleset>java-basic</ruleset>      <!-- default ruleset -->
                        <ruleset>java-imports</ruleset>    <!-- default ruleset -->
                        <ruleset>java-unusedcode</ruleset> <!-- default ruleset -->
                    </rulesets>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>pmd</goal>
                            <goal>cpd</goal>
                            <goal>cpd-check</goal>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.7</version>
                <configuration>
                    <rulesets>
                        <rulesets>
                            <ruleset>java-basic</ruleset>      <!-- default ruleset -->
                            <ruleset>java-imports</ruleset>    <!-- default ruleset -->
                            <ruleset>java-unusedcode</ruleset> <!-- default ruleset -->
                        </rulesets>
                    </rulesets>
                    <printFailingErrors>true</printFailingErrors>
                </configuration>

            </plugin>
        </plugins>
    </reporting>

</project>

当我使用mvn clean compile一些客户端代码时生成但有错误生成。

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project com.aepona.monetization.core: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more

java版本是1.8.0_25。我怎样才能解决这个问题?请帮忙。谢谢

4

0 回答 0