Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to build a spring boot application(need to support JSP files), but i want to create war package, not jar package, with bazel. but I find that there are no official rules for building war package. So how can I build war package with bazel. #22884

Open
luogeshibu opened this issue Jun 25, 2024 · 1 comment

Comments

@luogeshibu
Copy link

luogeshibu commented Jun 25, 2024

because My spring boot needs to support JSP files, but I find that the jar package can not support JSP files, So I want to create a WAR package with Bazel. I know the java_binary rule can create a jar package. and we already use the java_binary rule to run the spring boot application, we can run it, and we can access the swagger UI, but we can not access the JSP page, I only want to create the WAR package. Thanks.

@luogeshibu luogeshibu added team-Documentation Documentation improvements that cannot be directly linked to other team labels type: documentation (cleanup) untriaged labels Jun 25, 2024
@satyanandak satyanandak added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 25, 2024
@iancha1992 iancha1992 added team-Rules-Java Issues for Java rules type: feature request and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: documentation (cleanup) team-Documentation Documentation improvements that cannot be directly linked to other team labels labels Jun 25, 2024
@luogeshibu
Copy link
Author

vagrant@ubuntu:~/my_spring_boot$ tree .
.
├── BUILD.bazel
├── src
│   └── main
│   ├── java
│   │   └── com
│   │   └── example
│   │   └── devops
│   │   └── ci
│   │   ├── BUILD.bazel
│   │   ├──CIApplicationService.java # my spring boot main function file.
│   │   ├── aspect
│   │   │   ├── BUILD.bazel
│   │   │   └── OperationalLogAspect.java
│   │   ├── common
│   │   │   ├── BUILD.bazel
│   │   │   └── CommonUtils.java
│   │   ├── config
│   │   │   ├── BUILD.bazel
│   │   │   ├── MvcConfig.java
│   │   │   └── RestTemplateConfig.java
│   │   ├── controller
│   │      ├── BUILD.bazel
│   │      ├── BuildDefinitionAuditController.java
│   │      ├── ......
│   │      └── RefreshRadiatorController.java
│   ├── resources
│   │   ├── application.properties
│   │   ├── META-INF
│   │   │   └── additional-spring-configuration-metadata.json
│   │   └── static
│   │   ├── css
│   │   │   ├── error.css
│   │   │   └── main.css
│   │   ├── images
│   │   │   ├── Banner_Trimmed.png
│   │   │   ├── ......
│   │   │   └── Stages.png
│   │   └── js
│   │   ├── debugDataSet.js
│   │   ├── ......
│   │   └── util.js
│   └── webapp
│   └── jsp
│   ├── ......
│   └── manage.jsp
└── WORKSPACE.bazel

29 directories, 82 files

This is my part of the spring boot project tree. My spring boot application before using Gradle for building system tools. and it can build successfully and this spring boot project is already run on the product environment. The Gradle builds the spring boot project by WAR package. Now I only want to use Bazel with my spring boot application.

now I can use the java_binary rule to run my spring application. I can access Swagger UI, PNG, CSS, and JS. But I can not access my src/main/webapp/jsp/*.jsp files. we also find many documents on StackOverflow (https://stackoverflow.com/questions/21243690/is-it-possible-with-spring-boot-to-serve-up-jsps-with-a-jar-packaging) that said jar package can not run with JSP files. So currently, I need to build a war package with my spring boot project. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants