How to exclude lib-provided from spring boot
exclude mockito from spring boot
exclude in spring boot
spring-boot exclude hibernate
maven exclude file from dependency jar
spring-boot-maven-plugin exclude resources
spring-boot plugin configuration excludes
spring-boot exclude snakeyaml
My spring boot war is simply too large and I want to make some optimalisation. SPring boot has the option to run war with
java -jar, that is why
lib-provided (with all
provided dependecies) is still inside the war even though the dependecies are not needed there (I will never run it as standalone). Can I somehow disable this clever functionality, so that I can save some space?
UPDATE: I am using Maven and spring boot maven plugin.
Spring Boot Maven Plugin – Exclude a dependency, A boot-based project should consider provided dependencies as container This example excludes every artifacts having the my-lib or The Spring Boot Maven plugin repackages the JAR file created by the Maven JAR Plugin. So you also have the option to simply exclude files when the JAR is first built, which keeps the Spring Boot Maven plugin from finding them in the first place:
You can update your pom file based on this doc:
The only problem is that you cannot do an "exclude all"
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludeGroupIds>com.packagename,com.secondpackage</excludeGroupIds> <excludeArtifactIds>myartifact,artifactname2</excludeArtifactIds> </configuration> </plugin> </plugins> </build>
Spring Boot Maven Plugin, SPring boot has the option to run war with java -jar , that is why lib-provided (with all provided dependecies) is still inside the war even though the dependecies are Just to summarize, I want to use spring-boot-starter-parent and spring-boot-starter-data-jpa but not the managed selenium-java from spring-boot-dependencies. Appreciate any help in this regard. java maven spring-boot spring-data-jpa dependency-management
Don't use Spring-Boot repackage plugin, if you are never going to it run it as standalone. Use your normal maven war plugin (which excludes provided dependencies), which is enough for the deployed artifact.
How to exclude lib-provided from spring boot, @sekotin The excludes / exclude setting on the JAR plugin will only effect contents in the original jar. We ignore it when adding the nested JARs. I In this tutorial, we've explored how to exclude URL pattern(s) from a servlet filter in a Spring Boot web application for two use cases, namely logging and request header validation. Moreover, we learned that it gets tricky to rule-out a specific set of URLs for a filter that uses a * wildcard for matching all possible URL patterns.
I had similar issue.
Below is the solution which i added to remove the lib-provided jars
Please comment all the tomcat dependencies in the pom.xml or in build.gradle which eventually removes the jars in the lib-provided folder.
If you face any issues while running the application in local then added tomcat/jboss or any other server lib folder to the classpath.
spring-boot-maven-plugin includes "provided" scope dependency in , A spring boot web application can be packaged in a jar file or can be jars in lib-provided folder only, the boot war enhancement is only for In this case you have to exclude Tomcat from Spring Boot. So we should make Spring Boot exclude Tomcat as a dependency. To exclude Tomcat from Spring Boot just add an exclusion block to the Spring Boot Starter Web dependency and at the build time Maven will exclude Tomcat from Spring Boot.
Spring Boot - Executable war file structure, Explore how to make a thin jar using Spring Boot Thin Launcher. In this quick tutorial, we'll discuss how to exclude auto-configuration classes from Spring Boot tests. Spring Boot's auto-configuration feature is very handy, as it takes care of a lot of setup for us. However, this can also be an issue during testing if we don't want a certain auto-configuration to interfere with our tests of a module.
Thin JARs with Spring Boot, The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, allowing you to excludeDevtools, Boolean flag to indicate if the devtools jar should be I'm not sure if that's the spring-boot way of doing it, but you can exclude the tomcat jars using the maven-war-plugin configuration. That is, add the following to your pom.xml:
Spring Boot 1.5.9.RELEASE Reference, Here is an example where we exclude all JAR files from WEB-INF/lib: <project> <build>; <plugins>; <plugin>; <artifactId>maven-war-plugin</artifactId> When Spring-Boot projects are used with maven or gradle plugins they packaged the applicaiton by default as executable jars. These executable jars cannot be used as dependency in any another Spring-Boot project because the executable jar add classes in BOOT-INF/classes folder.
- Have you had a look here? docs.spring.io/autorepo/docs/spring-boot/1.2.1.RELEASE/…
- Suppose, you have to provide an info about the build tool used by you, in order to get an answer quicker.
- It's in the docs: docs.spring.io/spring-boot/docs/current/reference/htmlsingle/…
- What is in the docs?