Re: Skipping maven shade plugin in a spring-boot project based on maven profile

2019-12-20 Thread Debraj Manna
Thanks Maarten.

On Fri, Dec 20, 2019 at 12:07 PM Maarten Mulders  wrote:

> Also cross-posting from StackOverflow [1], where I just answered your
> question:
>
>
> There is a dedicated Spring Boot Maven Plugin [2] that also allows you
> to repackage your application. Its repackage goal automatically
> activates during the package phase, so you don't even need to define an
> execution.
>
> Back to your question, if you want to skip execution of a certain
> plugin, many plugins have a skip property that you can set. The Spring
> Boot Maven Plugin has one. You can set it in the XML configuration, but
> there's also a user property for it. As a result, your dev-local profile
> could look like this:
>
> 
>  dev-local
>  
>  true
>  
> 
>
> But you could even skip the profile completely and invoke Maven with
> -Dspring-boot.repackage.skip=true.
>
> The Maven Shade Plugin [3] has no such property documented, so that
> could be a reason for using the Spring Boot Maven Plugin over the Maven
> Shade Plugin.
>
> Finally, for building applications, you typically don't need mvn clean
> install, but mvn verify would be enough. Saves you a few seconds in
> execution and saves a lot of disk space in the long run since it doesn't
> copy built artifacts to your local Maven repo (~/.m2/repository or
> %userprofile%\.m2\repository).
>
>
> Hope this helps,
>
>
> Maarten
>
> References:
> [1] https://stackoverflow.com/a/59420813/1523342
> [2]
> https://docs.spring.io/spring-boot/docs/current/maven-plugin/index.html
> [3] https://maven.apache.org/plugins/maven-shade-plugin/index.html
>
> On December 20, 2019 at 06:04, Debraj Manna wrote:
>
> > 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
> >  I have made my pom.xml
> > like
> > below
> >
> >  > 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;>
> > 4.0.0
> >
> > com.van.saasinfra
> > saas-controller
> > 0.001-SNAPSHOT
> > jar
> >
> > saas-controller
> > SaaS Controller
> >
> > 
> > org.springframework.boot
> > spring-boot-starter-parent
> > 1.5.21.RELEASE
> >  
> > 
> >
> > 
> > ...
> > 
> >
> > 
> > 
> > dev-local
> > 
> > org.apache.maven.plugins
> > maven-shade-plugin
> > ${mvn.shade.plugin.version}
> > 
> > 
> > saas-controller-shade
> > none
> > 
> > 
> > 
> > 
> > 
> >
> > 
> > 
> > 
> > maven-shade-plugin
> > 
> > 
> > maven-antrun-plugin
> > 1.8
> > 
> > 
> > generate-sources
> > generate-sources
> > 
> > 
> >  > dir="${project.build.directory}/generated-sources"/>
> > 
> >  > value="--java_out=${project.build.directory}/generated-sources"/>
> >  > value="--proto_path=${project.basedir}/src/main/proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/saas-controller.proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/billing-controller.proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/node-topology.proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/availability.proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/dynamodb-config.proto"/>
> >  >
> value="${project.basedir}/src/main/proto/com/van/saasinfra/saascontroller/tenant-migration.proto"/>
> > 
> > 
> >
> > ${project.build.directory}/generated-sources/
> > 
> > 
> > run
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > 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?
>


Re: Skipping maven shade plugin in a spring-boot project based on maven profile

2019-12-19 Thread Maarten Mulders
Also cross-posting from StackOverflow [1], where I just answered your 
question:



There is a dedicated Spring Boot Maven Plugin [2] that also allows you 
to repackage your application. Its repackage goal automatically 
activates during the package phase, so you don't even need to define an 
execution.


Back to your question, if you want to skip execution of a certain 
plugin, many plugins have a skip property that you can set. The Spring 
Boot Maven Plugin has one. You can set it in the XML configuration, but 
there's also a user property for it. As a result, your dev-local profile 
could look like this:



dev-local

true



But you could even skip the profile completely and invoke Maven with 
-Dspring-boot.repackage.skip=true.


The Maven Shade Plugin [3] has no such property documented, so that 
could be a reason for using the Spring Boot Maven Plugin over the Maven 
Shade Plugin.


Finally, for building applications, you typically don't need mvn clean 
install, but mvn verify would be enough. Saves you a few seconds in 
execution and saves a lot of disk space in the long run since it doesn't 
copy built artifacts to your local Maven repo (~/.m2/repository or 
%userprofile%\.m2\repository).



Hope this helps,


Maarten

References:
[1] https://stackoverflow.com/a/59420813/1523342
[2] 
https://docs.spring.io/spring-boot/docs/current/maven-plugin/index.html

[3] https://maven.apache.org/plugins/maven-shade-plugin/index.html

On December 20, 2019 at 06:04, Debraj Manna wrote:


I am cross-posting from stackoverflow

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
 I have made my pom.xml 
like

below

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;>
4.0.0

com.van.saasinfra
saas-controller
0.001-SNAPSHOT
jar

saas-controller
SaaS Controller


org.springframework.boot
spring-boot-starter-parent
1.5.21.RELEASE
 



...




dev-local

org.apache.maven.plugins
maven-shade-plugin
${mvn.shade.plugin.version}


saas-controller-shade
none









maven-shade-plugin


maven-antrun-plugin
1.8


generate-sources
generate-sources















${project.build.directory}/generated-sources/


run







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?


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org