有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Maven包只在jar中大摇大摆地生成模型,不包括其他依赖项

我的项目是从OpenAPI合同生成模型,以下是pom文件中的配置:

<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
        <execution>
            <id>execution1</id>
            <goals>
                <goal>generate</goal>
            </goals>

            <configuration>
                <inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
                <modelPackage>com.mypackage.app.models</modelPackage>
                <output>${project.build.directory}/../target/generated-sources</output>
            </configuration>
        </execution>
    </executions>
</plugin>

运行build将在${project.build.directory}/../target/generated-sources/src/main/java${project.build.directory}/../target/classes中生成类

现在,我想将上述任意位置的模型打包到一个jar中,而不需要任何其他依赖项。换句话说,我希望在com.mypackage.app.models包中有一个纯生成模型类的jar

有办法吗?我已经看到了一些排除包的方法,但不只是包括特定的包

我正在使用Java8和Maven 3


共 (0) 个答案