I am cross-posting from stackoverflow
<https://stackoverflow.com/questions/59393863/skipping-maven-shade-plugin-in-a-spring-boot-project-based-on-maven-profile>
as I did not get any reply there.

I want to skip the execution of maven-shade-plugin when a certain maven
profile is activated on a spring-boot project. As mentioned in this answer
<https://stackoverflow.com/a/13383092/785523> I have made my pom.xml like
below

<?xml version="1.0" encoding="UTF-8"?><project
xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.van.saasinfra</groupId>
    <artifactId>saas-controller</artifactId>
    <version>0.001-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>saas-controller</name>
    <description>SaaS Controller</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.21.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>


    <dependencies>
    ...
    </dependencies>

    <profiles>
        <profile>
            <id>dev-local</id>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${mvn.shade.plugin.version}</version>
                <executions>
                    <execution>
                        <id>saas-controller-shade</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <target>
                                <mkdir
dir="${project.build.directory}/generated-sources"/>
                                <exec executable="protoc">
                                    <arg
value="--java_out=${project.build.directory}/generated-sources"/>
                                    <arg
value="--proto_path=${project.basedir}/src/main/proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/saas-controller.proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/billing-controller.proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/node-topology.proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/availability.proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/dynamodb-config.proto"/>
                                    <arg
value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/tenant-migration.proto"/>
                                </exec>
                            </target>

<sourceRoot>${project.build.directory}/generated-sources/</sourceRoot>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build></project>

But even when doing maven clean install -Pdev-local I am seeing shade step
is still getting executed.

Can some suggest how to stop the execution of shade when a certain profile
is enabled on a spring boot project?

Reply via email to