Merge pull request #2188 from anirudhasht
Some checks failed
Java CI with Gradle / build (17) (push) Failing after 4s
Java CI with Maven / build (17) (push) Successful in 1m40s

* pr/2188:
  Polish "Fix Java version mismatch and clarify Gradle usage in readme"
  Fix Java version mismatch and clarify Gradle usage in readme

Closes gh-2188
This commit is contained in:
Stéphane Nicoll 2026-01-02 08:12:34 +01:00
commit ab1d5364a0

View file

@ -14,28 +14,31 @@ See the presentation here:
## Run Petclinic locally
Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/).
Java 17 or later is required for the build, and the application can run with Java 17 or newer:
Java 17 or later is required for the build, and the application can run with Java 17 or newer.
You first need to clone the project locally:
```bash
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
./mvnw package
java -jar target/*.jar
```
If you are using Maven, you can start the application on the command-line as follows:
(On Windows, or if your shell doesn't expand the glob, you might need to specify the JAR file name explicitly on the command line at the end there.)
```bash
./mvnw spring-boot:run
```
With Gradle, the command is as follows:
```bash
./gradlew bootRun
```
You can then access the Petclinic at <http://localhost:8080/>.
<img width="1042" alt="petclinic-screenshot" src="https://cloud.githubusercontent.com/assets/838318/19727082/2aee6d6c-9b8e-11e6-81fe-e889a5ddfded.png">
Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this, it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this):
```bash
./mvnw spring-boot:run
```
> NOTE: If you prefer to use Gradle, you can build the app using `./gradlew build` and look for the jar file in `build/libs`.
You can, of course, run Petclinic in your favorite IDE.
See below for more details.
## Building a Container
@ -98,7 +101,7 @@ There is a `petclinic.css` in `src/main/resources/static/resources/css`. It was
The following items should be installed in your system:
- Java 25 or newer (full JDK, not a JRE)
- Java 17 or newer (full JDK, not a JRE)
- [Git command line tool](https://help.github.com/articles/set-up-git)
- Your preferred IDE
- Eclipse with the m2e plugin. Note: when m2e is available, there is a m2 icon in `Help -> About` dialog. If m2e is