All Questions
Tagged with spring-boot gradle
2,743
questions
310
votes
19
answers
509k
views
How do I activate a Spring Boot profile when running from IntelliJ?
I have 5 environments:
- local (my development machine)
- dev
- qc
- uat
- live
- staging
I want different application properties to be used for each environment, so I have the following ...
139
votes
7
answers
69k
views
Spring Boot 2.5.0 generates plain.jar file. Can I remove it?
After the Spring Boot 2.5.0 update, it generates the myprogram-0.0.1-plain.jar file alongside the usual myprogram-0.0.1.jar. Can I disallow gradle to generate the *.plain.jar file? I use Gradle 7.0.2.
...
122
votes
10
answers
102k
views
How to pass JVM options from bootRun
I'm developing simple Spring web application that communicates with remote host and I would like to test it locally behind corporate proxy.
I use "Spring Boot" gradle plugin and the question is how ...
112
votes
15
answers
155k
views
Spring Boot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'
I'm trying to initiate a Spring Boot project using OpenJDK 15, Spring Boot 2.6.0, Springfox 3.
We are working on a project that replaced Netty as the web server and used Jetty instead, because we do ...
84
votes
2
answers
84k
views
What is the spring-boot-configuration-processor ? Why do people exclude libraries from it? Why is it invisible in dependency tree?
Introduction
So I noticed the following line in the gradle file of the jhipster project:
annotationProcessor ("org.springframework.boot:spring-boot-configuration-processor") {
exclude group: ...
79
votes
8
answers
66k
views
Spring Boot 3.x upgrade. Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.1
I recently wanted to upgrade my kotlin project from spring boot 2.7.x to 3.0.1. I use Java 17 temurin, gradle 7.6. In IntelliJ I got following error message on importing the project over gradle:
A ...
75
votes
21
answers
217k
views
Unable to connect to Postgres DB due to the authentication type 10 is not supported
I have recently tried my hands on Postgres. Installed it on local (PostgreSQL 13.0).
Created a maven project and used Spring Data JPA, works just fine. Whereas when I tried using Gradle project, I am ...
69
votes
10
answers
138k
views
springboot Upgrade from 2.3.5.RELEASE to 2.4.1- ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
I am trying to upgrade my kotlin - gradle project from springboot version 2.3.5.RELEASE to 2.4.1. Looks like there is version mismatch between springboot-2.4.1 and sping-cloud-Hoxton.SR9.
build.gradle....
65
votes
27
answers
405k
views
Web server failed to start. Port 8080 was already in use. Spring Boot microservice
I am trying to call webAPI from gradle project.
My build.gradle is as following.
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
}
apply plugin: 'io.spring....
63
votes
1
answer
61k
views
What is the difference between "gradle bootRun" and "gradle run" to run a springboot application?
To run a Spring Boot application, there are two gradle tasks:
gradle bootRun
gradle run
Both tasks can be used to run the Spring Boot application, what are the main differences between these tasks?
57
votes
14
answers
80k
views
How to pass system property to Gradle task
I'm using Gradle spring-boot plugin and I need to select a spring active profile for the test run.
How do I pass spring.profiles.active system property to the bootRun plugin's task?
What has already ...
54
votes
8
answers
123k
views
Spring Boot project in IntelliJ community edition
I am new to IntelliJ Community edition. Can anyone help me with creating spring boot project in intelliJ Community edition. For ultimate edition there is spring-boot initializer but I cannot find ...
48
votes
7
answers
116k
views
Spring Boot + Gradle: how to build executable jar
I'm trying to build an executable jar in Spring Boot + Gradle project, but for now nothing works. Here is the simplest possible structure. Possibly, something is missing in Gradle configuration.
...
46
votes
4
answers
20k
views
IntelliJ does not terminate Spring Boot applications build with gradle
I am using IntelliJ 13.1 on Linux and try to build a basic REST application following the example http://spring.io/guides/gs/spring-boot/
When I execute the target bootRun from within IntelliJ the ...
44
votes
8
answers
41k
views
Spring Boot 2 - Change Jar Name
I am using Spring Boot 2 in my Gradle project to do a build to jar in Jenkins, and I would like to change the name of that jar file.
By default, Spring Boot 2 used the Gradle property rootProject....
43
votes
4
answers
40k
views
How to start Spring Boot app in Spock Integration Test
What is the best way to run an integration test (e.g., @IntegrationTest) with Spock? I would like to bootstrap the whole Spring Boot application and execute some HTTP calls to test the whole ...
43
votes
11
answers
133k
views
spring-boot gradle plugin can't be found
I have a separate gradle script that is just adding spring-boot plugin. It looks like this:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://...
42
votes
6
answers
160k
views
Configuration using annotation @SpringBootApplication
I have problem with Spring Boot configuration.
I have created base Spring Boot project using https://start.spring.io/
And I have a problem, configuration works only for classes in sub catalog:
I ...
39
votes
5
answers
35k
views
in intelliJ spring boot gradle plugin 3.0.0 no matching variant found
I'm trying to use version 3.0.0 of the spring boot Gradle plugin. Here's my build.gradle.kts file:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework....
38
votes
4
answers
120k
views
Configure ViewResolver with Spring Boot and annotations gives No mapping found for HTTP request with URI error
I'm trying to make "hello world" application with gradle, spring boot and spring mvc with the simplest view resolver and html.
I started from the thymeleaf spring boot example and I just wanted to ...
37
votes
4
answers
34k
views
Websocket in Spring Boot app - Getting 403 Forbidden
Websocket in Spring Boot app - Getting 403 Forbidden
I can connect to the websocket from client using sockjs/stompjs when I run this in eclipse (no spring boot).
But when I create a Spring boot jar(...
37
votes
3
answers
99k
views
Spring Boot default test throws an IllegalStateException
I am starting to play with spring boot and I have problems with fresh new installation.
I have created initial project using http://start.spring.io .. here is my build.gradle:
buildscript {
ext {...
36
votes
3
answers
99k
views
Using lombok with gradle and spring-boot
I am trying to build a project with lombok and this is what I have as dependencie.
dependencies {
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework....
35
votes
4
answers
24k
views
Spring Boot multi module project with Gradle doesn't build
I'm working on a Spring Boot app with multiple modules and we're using Gradle to build it. Unfortunately I can't get the Gradle configuration right.
The project structure is this:
parent
|
+ ...
34
votes
4
answers
159k
views
gradle process command java finished with non-zero exit value 1
I am getting the following error when I type gradle bootRun --stacktrace --debug in the CentOS 7 terminal to use gradle to launch this sample spring boot app.
Caused by: org.gradle.process.internal....
33
votes
5
answers
35k
views
Getting the Gradle.build version into Spring Boot
I'm trying to display the application version of my Spring Boot application in a view. I'm sure I can access this version information, I just don't know how.
I tried following this information: https:...
32
votes
7
answers
52k
views
Unable to find main class :bootRepackage
I got a problem with my gradle build. I use the standard proposed by the Spring Website (https://spring.io/guides/gs/rest-service/), but when I try to use gradle build, I got this error :
It doesnt ...
32
votes
7
answers
301k
views
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
I am trying to write a standalone executable jar (fat jar) . I am using spring boot gradle plugin and writing a SpringBoot App to do this.
Here is my Application.java file
@Configuration
@...
32
votes
3
answers
27k
views
Maven profiles equivalent of Gradle
I'm trying to achieve a simple scenario in my spring boot project build: including / excluding dependencies and packaging war or jar depending on the environment.
So for example, for the environment ...
31
votes
16
answers
113k
views
Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] was not found in any of the following sources:
I have just downloaded the springboot project from http://start.spring.io/. After running it I got this error.
* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] was ...
30
votes
11
answers
29k
views
Autowiring BuildProperties bean from Gradle - NoSuchBeanDefinitionException
I am trying to obtain the version in my Java application from the Gradle build file. I am following the instructions here;
https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build....
29
votes
5
answers
42k
views
Plugin with id 'org.sonarqube' not found
I am trying to implement sonar with gradle for code-coverage measure for my project.
we are using gradle-4.0.1 and sonarqube-6.4 .
when I run gradle sonarqube from command line I get this error-
...
28
votes
4
answers
64k
views
org.springframework.boot.web.support does not exist
I'm changing build systems from maven to gradle for a spring boot project. I get this stacktrace
19:03:08: Executing external task 'bootRun'...
/home/dac/proj/spring-boot-master/spring-boot-samples/...
28
votes
2
answers
19k
views
Why does my Spring Boot web app not run completely in Gradle?
I've been trying to set up a new Spring Boot Web application using the following command:
spring init --java-version=1.7 --build=gradle --packaging=war --groupId=me.psychopunch.lab.springboot --...
27
votes
1
answer
24k
views
@DataJpaTest needing a class outside the test
In a SpringBoot application, I would like to do some test about the repository layer.
@RunWith(SpringRunner.class)
@DataJpaTest
public class VisitRepositoryTest {
@Autowired
private ...
27
votes
2
answers
50k
views
I'm getting "NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil"
I have the following dependencies in my build.gradle file.
compile 'org.slf4j:slf4j-api:1.7.25'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.1'
compile group: 'org....
26
votes
3
answers
13k
views
Type 'JavaCompile' property 'options.compilerArgumentProviders.apt$0.name' is missing an input or output annotation. error after upgrading to Gradle 7
After upgrading to Gradle 7.0 and making a build, I'm getting following failure:
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found ...
25
votes
1
answer
28k
views
Difference between gradle build and gradle bootJar?
What is the difference between "gradle build" and "gradle bootJar"? Why would I use bootJar if I can still create the artifact using build?
25
votes
2
answers
17k
views
Gradle > How to stop a Spring Boot application launched with gradle bootRun?
I started a spring boot application using gradle bootRun.
Doing ctrl-c in the terminal where I launched the command does not stop the application.
What is then the correct way of stopping it?
24
votes
2
answers
38k
views
Cannot resolve external dependency org.springframework.boot:spring-boot-starter: because no repositories are defined
I have a multibuild project and I am currently just setting it up. Each module naturally each has a gradle.build file that only contains the following:
dependencies {
}
In the main build.gradle ...
22
votes
3
answers
13k
views
Spring Boot bootRun with continuous build
It should be possible to have a Spring Boot app continuously build (i.e. hot reload) by running gradle build --continuous and gradle bootRun in sequence.
I'm trying to modify the bootRun task in the ...
22
votes
1
answer
17k
views
Gradle 7.2 Java 17 Build issue java.lang.NullPointerException: Cannot read field "bindingsWhenTrue" because "currentBindings" is null
Testing out upgrading some services to Java 17 now that it is GA and ran into the following issue compiling a Gradle 7.2 Spring Boot Application:
> Task :compileJava
Note: Some input files use or ...
21
votes
8
answers
63k
views
Spring Boot API with Multiple Controllers?
I am starting to learn Spring Boot. I am struggling to find an example with multiple RestControllers, which indicates to me that I may be doing something wrong. I am trying a very simple example: The ...
21
votes
3
answers
26k
views
How to use gradle. Java, and Groovy together?
I am trying to use a Gradle project in IntelliJ 13 but I keep running into issues such as:
Java files can't see Groovy files
IntelliJ seems to forget about Groovy and prompts me to configure a GDK ...
21
votes
2
answers
14k
views
Gradle building Spring Boot library without Main Class
I am trying to build a Spring Boot/Gradle project and create a jar without a main class. My purpose is that this project is a library that will be pulled in by other projects therefore the library ...
20
votes
21
answers
59k
views
Springboot swagger url shows WhiteLabel Error page
Here is my code: I am getting all the values from application.properties file
SwaggerConfig.java
@Configuration
@EnableSwagger2
@Profile("!prod")
@PropertySource(value = { "classpath:application....
20
votes
5
answers
42k
views
Spring Boot plugin requires Gradle 4.10 or later. The current version is Gradle 4.1
I have a Spring Gradle project. I'm trying to make a build using gradle build command. But getting below error :
* Where:
Build file 'F:\MyProjectName\build.gradle' line: 2
* What went wrong:
An ...
20
votes
4
answers
20k
views
How to fix gradle build failed due to void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.<init>(org.gradle.api.provider.Provider) error?
I am getting following exception when I try to build the spring boot project using Gradle build command. The code comiples and runs fine in IntelliJ Idea.
PS C:\SVN\Dactyl\IIOTWizards\SCADA\Trunk\...
20
votes
1
answer
11k
views
Gradle dependency plugin in a multi module Spring Boot project
What does a correct Gradle configuration look like in a multi-module project that uses the Gradle plugins spring-boot-dependencies and spring-boot?
I have the following project setup:
parent
|
+ ...
20
votes
1
answer
5k
views
Kotlin + Gradle Unresolved Reference
As per this question I'm trying to setup the following project structure
project/
settings.gradle
projectB/ # some common code (using spring-boot)
build.gradle
com/
foo/...