【问题标题】:how to execute two maven version plugin?如何执行两个maven版本插件?
【发布时间】:2018-07-12 13:52:40
【问题描述】:

如何执行两个maven版本插件?我试试这个,但全部在 3.0.0-SNAPSHOT 中执行

我有一个问题,因为 V2.x.x 使用 V2 swagger 文件,而 v3.0.0 使用 V3 swagger 文件。

<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
        <execution>
            <id>first in v2</id>
            ...
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>3.0.0-SNAPSHOT</version>
    <executions>
        <execution>
            <id>second in v3</id>
            ...
        </execution>
    </executions>
</plugin>

【问题讨论】:

  • 请将您看到的错误添加到您的问题中。
  • 我已经写了我的问题:Maven 在 3.0.0-SNAPSHOT 中执行,而不是 2.3.1 版本中的第一个

标签: java maven swagger


【解决方案1】:

关注

Can Maven 2 use two different versions of a build plugin in the same project?

不可能做你想做的事。我看到的唯一机会是获取源代码并以不同的名称编译插件。在你这样做之前,我真的会寻找另一种方法来实现你想要实现的目标。

【讨论】:

    【解决方案2】:

    我使用父/模块 Maven 功能。

    MyProject-parent

    <modules>
        <module>foodle-importer-core</module>
        <module>foodle-api</module>
        <module>diffusion-api</module>
    </modules>  
    

    架构:

    MyProject-parent
           ---------ModuleA-SourceGeneratorV2 (contain swagger-codegen-maven-plugin v2.3.1)
           ---------ModuleB-SourceGeneratorV3 (contain swagger-codegen-maven-plugin v3.0.0-SNAPSHOT)
           ---------ModuleC-MyProject (contain `ModuleA-SourceGeneratorV2` and `ModuleB-SourceGeneratorV3` dependencies)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-17
      • 1970-01-01
      • 1970-01-01
      • 2016-02-27
      • 2013-10-20
      • 2010-10-21
      • 1970-01-01
      相关资源
      最近更新 更多