简体   繁体   English

使用build.gradle进行部署

[英]Use build.gradle for deployment

I'm learning how to use gradle to build my java applications. 我正在学习如何使用gradle来构建我的java应用程序。 Currently I'm using eclipse with buildship plugin. 目前我正在使用带有buildship插件的eclipse。 I have it building my JARs and WARs, and also have gradle running my JUnit and Selenium tests. 我有它构建我的JAR和WAR,还有gradle运行我的JUnit和Selenium测试。 I like that it pulls in the dependencies I need as I need them during development. 我喜欢它在我开发过程中需要它时会引入我需要的依赖项。

It seems like it would make sense if my build.gradle files define my dependencies to build and run my application in dev then I should be able to use them for deployment. 看起来我的build.gradle文件定义了我的依赖项来构建和运行我的应用程序然后我应该能够使用它们进行部署似乎是有意义的。 Otherwise I have to retrieve all my dependencies by some other means and deploy to my production environment, and managing 2 different methods of retrieving and deploying dependencies seems to be a risk for problems. 否则,我必须通过其他方式检索所有依赖项并部署到我的生产环境,并且管理2种不同的检索和部署依赖项的方法似乎是存在问题的风险。

Can I use gradle or at least my build.gradle files in some way for my deployment? 我可以以某种方式使用gradle或至少我的build.gradle文件进行部署吗?

Take a look at the gradle distribution plugin . 看一下gradle分发插件 This plugin adds tasks to create an "install folder" or an archive file (zip or tar) containing all the dependencies you'll need to execute/deploy your application. 此插件添加了创建“安装文件夹”或存档文件(zip或tar)的任务,其中包含执行/部署应用程序所需的所有依赖项。

Gradle application plugin also generates shell/bat scripts to invoke your application. Gradle应用程序插件还会生成shell / bat脚本以调用您的应用程序。

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

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