title: Maven: is it possible to specify a different version of a same plugin for multiple profiles, while activating all those profiles at the same time?
body: <p>I have a Maven project in which I've created some API definitions with Swagger. Using <code>openapi-generator-maven-plugin</code>, I'm generating both JAVA code and TypeScript code to use the API. </p>
  
  <p>In my <code>pom.xml</code> configuration, I've defined a Maven profile for each language. Thing is I'd like to use version 4.2.0 of this plugin when generating JAVA code, and version 4.3.0 when generating TypeScript code: I was using version 4.2.0 in both profile but some new features appeared in version 4.3.0 for TypeScript generation, and after some tests, I figured there were some side-effects I'd like to avoid for JAVA generation.</p>
  
  <p>When each profile is activated on its own, everything is working as expected. 
  <strong>But if I activate both profiles, Maven is using the most recent version of the plugin: 4.3.0.</strong> </p>
  
  <p>As my Maven project will be built in a CI/CD server, I was wondering if it was possible to use a specific version of a same maven plugin on a profile basis during a single build, or do I need to create a separate build for each profile?</p>
  
  <p>My <code>pom.xml</code> looks like this:</p>
  
  
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;java&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.openapitools&lt;/groupId&gt;
                      &lt;artifactId&gt;openapi-generator-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;4.2.0&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;generate-api-java-model&lt;/id&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;generate&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;phase&gt;generate-sources&lt;/phase&gt;
                              &lt;configuration&gt;
                                  ...
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;typescript&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.openapitools&lt;/groupId&gt;
                      &lt;artifactId&gt;openapi-generator-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;4.3.0&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;generate-api-ts-model&lt;/id&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;generate&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;phase&gt;generate-sources&lt;/phase&gt;
                              &lt;configuration&gt;
                                ...
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>