Skip plugin execution based on property

In my Maven build, I use a maven-processor-pluginJPA metamodel to create, for example,

<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <version>2.2.4</version>
    <executions>
        <execution>
            <id>process</id>
            <goals>
                <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
            ....
        </execution>
</plugin>

Now I would like to skip creating a meta-model based on a property like this

$ mvn -Dspeed.up.build.from.eclipse=true

Unfortunately, it maven-processor-plugindoes not support the configuration tag <skip>${speed.up.build.from.eclipse}</skip>, as some plugins do.

I could put my plugin in the profile and then activate it based on my property. But then I need to somehow deny the value of the property ...

I need:

  • Run the plugin if the property has not been set
  • Skip plugin execution if property has been set

Is there a good way to archive it? If so, how?

+4
source share
1 answer

, skip.

none, . 2 profiles

  • speed.up.build.from.eclipse, maven-annotation-plugin.phase none;
  • - , , .

.

, , .


( ) . GitHub, , . , , .

+3

Source: https://habr.com/ru/post/1623331/


All Articles