简体   繁体   English

如何为 java web 应用程序创建开发服务器

[英]How to create a development server for a java web application

We want to build a java web application (servlets and JSP) with multiple developers for our school project, and I want to optimize the development workflow for a couple of reasons:我们想为我们的学校项目与多个开发人员一起构建一个 java web 应用程序(servlet 和 JSP),我想优化开发工作流程有几个原因:

  1. So we can all work with the same tools and with the same versions (SDK, tomcat-server, MySQL database)所以我们都可以使用相同的工具和相同的版本(SDK、tomcat-server、MySQL 数据库)

  2. prevent the known "but it works on my machine" statement.防止已知的“但它在我的机器上工作”声明。

  3. Set developers up and running quickly, no need to install software on the host machine.快速设置开发人员并运行,无需在主机上安装软件。

  4. Learning purposes.学习目的。

So what I was thinking to do is to set up a VM and configure it using vagrant to install the proper SDK, tomcat server, and MySQL client-server, maybe even set up a docker-compose file inside the vagrant machine? So what I was thinking to do is to set up a VM and configure it using vagrant to install the proper SDK, tomcat server, and MySQL client-server, maybe even set up a docker-compose file inside the vagrant machine? is that a good idea?这是一个好主意吗?

We are not bound to any IDE, and I found some useful vagrant boxes that can help:我们不受任何 IDE 的约束,我发现了一些有用的 vagrant 盒子可以提供帮助:

https://github.com/ssledz/vagrant-boxes/tree/master/java-dev-environment https://github.com/timofurrer/java-dev https://github.com/ssledz/vagrant-boxes/tree/master/java-dev-environment https://github.com/timofurrer/java-dev

Can I configure the IDE to use my running tomcat-server when the machine is booting, without the need to configure it manually on the IDE?我可以将 IDE 配置为在机器启动时使用我正在运行的 tomcat-server,而无需在 IDE 上手动配置它吗?

Is that an overkill?这是不是矫枉过正? should we create a simpler development server?我们应该创建一个更简单的开发服务器吗? if so, how?如果是这样,怎么做?

Now as you may have guessed we don't have a lot of experience with Java web application development or working as a team, but it's a good opportunity to learn, so feel free to suggest a different approach, the main goal here is to get a development workspace we could all use, and following best practices and industry standards.现在您可能已经猜到了,我们在 Java web 应用程序开发或团队工作方面没有太多经验,但这是一个学习的好机会,所以请随意提出不同的方法,这里的主要目标是获得我们都可以使用的开发工作空间,并遵循最佳实践和行业标准。

How could we achieve that?我们怎样才能做到这一点?

So what I was thinking to do is to set up a VM and configure it using vagrant to install the proper SDK, tomcat server, and MySQL client-server, maybe even set up a docker-compose file inside the vagrant machine? So what I was thinking to do is to set up a VM and configure it using vagrant to install the proper SDK, tomcat server, and MySQL client-server, maybe even set up a docker-compose file inside the vagrant machine? is that a good idea?这是一个好主意吗?

Of course, it is a good idea.当然,这是个好主意。 Docker became so popular for the same reason.出于同样的原因,Docker 变得如此受欢迎。

will it be easier working with eclipse?使用 eclipse 会更容易吗?

IntelliJ IDE and eclipse are equally good and popular. IntelliJ IDEeclipse同样出色且受欢迎。 Both of them have some features different from each other.它们都有一些彼此不同的特征。 So, the choice of and IDE should depend on your experience with the IDE.因此,IDE 的选择应取决于您对 IDE 的经验。

How should we deploy the app to the tomcat server running on the virtual machine?我们应该如何将应用部署到虚拟机上运行的 tomcat 服务器上? with another server on the host machine?与主机上的另一台服务器?

I suggest you build a CI/CD pipeline using Jenkins.我建议您使用 Jenkins 构建一个 CI/CD 管道。 Also, do use some source control software (I recommend git ).另外,一定要使用一些源代码控制软件(我推荐git )。

Ok, so What I did was to build on an existing vagrant java-dev box that comes with java and eclipse, and I added a script to install tomcat server 7, and a MySQL database with some mock data. Ok, so What I did was to build on an existing vagrant java-dev box that comes with java and eclipse, and I added a script to install tomcat server 7, and a MySQL database with some mock data.

Here is a link: https://github.com/nati-elmaliach/vagrant-java-development-server这是一个链接: https://github.com/nati-elmaliach/vagrant-java-development-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM