Git Product home page Git Product logo

Comments (5)

seanf avatar seanf commented on July 19, 2024 1

@deweyjose Juggling Maven profiles can be a pain in the neck. Most popular Maven plugins seem to end up with a skip option eventually, probably because it's such a pain otherwise.

skip is just generally useful, but two cases have come up recently:

  1. Configure the plugin at the top level of a multi-module project, but configure it to skip in all the modules except one. This allows invoking the plugin from the top level (and using the short invocation which omits the groupId) without running it against modules where it makes no sense.
  2. In a CI situation, I may need to run parts of the Maven lifecycle again in a different stage of the pipeline. If the code has already been generated, it's nice to have the option to skip unnecessary code generation easily. With this feature, adding -Ddgs.codegen.skip is a small change which doesn't affect the pom. Without a built-in skip feature, achieving the same thing with a Maven profile (activated by the absence of a command line property) will require changes to at least one pom, and several lines of XML. This could also be achieved with the environment variable you suggest, but I think -Ddgs.codegen.skip is more readable than DGSPHASE=none, especially if you need to skip multiple plugins.

from graphqlcodegen.

seanf avatar seanf commented on July 19, 2024 1

Thanks @deweyjose and @zorglube!

from graphqlcodegen.

zorglube avatar zorglube commented on July 19, 2024

Here it is Add Skip Option PR, know we're waiting for @deweyjose to merge it.
By the time you can build the plugin on you side (mvn install) to get the option eralier.

from graphqlcodegen.

deweyjose avatar deweyjose commented on July 19, 2024

Hi @seanf I'd like to learn a little more about this use-case first.

Why invoke the codegen plugin at all in this case? Have you taken a look at ways to achieve this with maven profiles - different plugins enabled for different profiles?

Another option could be to use environment variables:

<plugin>
  <groupId>io.github.deweyjose</groupId>
  <artifactId>graphqlcodegen-maven-plugin</artifactId>
  <version>1.15</version>
  <executions>
    <execution>
      <goals>
        <goal>generate</goal>
      </goals>
      <phase>${env.DGSPHASE}</phase>
    </execution>
  </executions>
</plugin>

The plugin will run:

export DGSPHASE=generate-sources; mvn clean install

The plugin will not run:

export DGSPHASE=none; mvn clean install

from graphqlcodegen.

zorglube avatar zorglube commented on July 19, 2024

@deweyjose definitly the solution you purposed work to enable/disable codegen. However, I have a preference for the -Ddgs.codegen.skip=true option.
That's my point of view.

from graphqlcodegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.