如何运行使用gradle打包的项目
目标:https://github.com/davenkin/springmvc4-helloworld
使用SpringMVC编写的一个HelloWorld程序。
初学Gradle只能一步步摸索前进。
该项目对应的build.gradle
apply plugin: 'idea'
apply plugin: 'jetty' repositories {
mavenCentral()
} dependencies {
compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
providedCompile 'javax.servlet:servlet-api:2.5'
} task wrapper(type: Wrapper) {
gradleVersion = '3.0'
}
文件结构:
D:\N3verL4nd\Desktop\springmvc4-helloworld>tree /f
卷 本地磁盘 的文件夹 PATH 列表
卷序列号为 00000200 0006:08B0
D:.
│ .gitignore
│ build.gradle
│ gradlew
│ gradlew.bat
│ README.md
│
├─gradle
│ └─wrapper
│ gradle-wrapper.jar
│ gradle-wrapper.properties
│
└─src
└─main
├─java
│ └─hello
│ HomeController.java
│
├─resources
│ applicationContext.xml
│
└─webapp
└─WEB-INF
│ spring-servlet.xml
│ web.xml
│
└─jsp
hello.jsp D:\N3verL4nd\Desktop\springmvc4-helloworld>
编译该项目:
D:\N3verL4nd\Desktop>git clone https://github.com/davenkin/springmvc4-helloworld
Cloning into 'springmvc4-helloworld'...
remote: Counting objects: 127, done.
Receiving objects: 37% (47/127) 0 (delta 0), pack-reused 127 ts: 30% (39/127)
Receiving objects: 100% (127/127), 68.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (34/34), done. D:\N3verL4nd\Desktop>cd springmvc4-helloworld D:\N3verL4nd\Desktop\springmvc4-helloworld>gradle build
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
The Jetty plugin has been deprecated and is scheduled to be removed in Gradle 4.0. Consider using the Gretty (https://github.com/akhikhl/gretty) plugin instead.
at build_6z4w2swcyg02xyim9zhjsclh0.run(D:\N3verL4nd\Desktop\springmvc4-helloworld\build.gradle:2)
:compileJava
:processResources
:classes
:war
:assemble
:compileTestJava NO-SOURCE
:processTestResources NO-SOURCE
:testClasses UP-TO-DATE
:test NO-SOURCE
:check UP-TO-DATE
:build BUILD SUCCESSFUL Total time: 26.685 secs
D:\N3verL4nd\Desktop\springmvc4-helloworld>gradle tasks
The Jetty plugin has been deprecated and is scheduled to be removed in Gradle 4.0. Consider using the Gretty (https://github.com/akhikhl/gretty) plugin instead.
at build_6z4w2swcyg02xyim9zhjsclh0.run(D:\N3verL4nd\Desktop\springmvc4-helloworld\build.gradle:2)
:tasks ------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------ Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
war - Generates a war archive with all the compiled classes, the web-app content and the libraries. Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating] Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code. Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'springmvc4-helloworld'.
components - Displays the components produced by root project 'springmvc4-helloworld'. [incubating]
dependencies - Displays all dependencies declared in root project 'springmvc4-helloworld'.
dependencyInsight - Displays the insight into a specific dependency in root project 'springmvc4-helloworld'.
dependentComponents - Displays the dependent components of components in root project 'springmvc4-helloworld'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'springmvc4-helloworld'. [incubating]
projects - Displays the sub-projects of root project 'springmvc4-helloworld'.
properties - Displays the properties of root project 'springmvc4-helloworld'.
tasks - Displays the tasks runnable from root project 'springmvc4-helloworld'. IDE tasks
---------
cleanIdea - Cleans IDEA project files (IML, IPR)
idea - Generates IDEA project files (IML, IPR, IWS) Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests. Web application tasks
---------------------
jettyRun - Uses your files as and where they are and deploys them to Jetty.
jettyRunWar - Assembles the webapp into a war and deploys it to Jetty.
jettyStop - Stops Jetty. Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration. To see all tasks and more detail, run gradle tasks --all To see more detail about a task, run gradle help --task <task> BUILD SUCCESSFUL Total time: 1.348 secs
D:\N3verL4nd\Desktop\springmvc4-helloworld>
测试:
如上所示,本地有Gradle环境,如果没有的话需要使用gradlew build命令
它会自动去下载gradle运行环境
由于未知的下载速度问题,最好使用梯子,下载下来如下配置也是可以的。
D:\N3verL4nd\Desktop\springmvc4-helloworld\gradle\wrapper\gradle-wrapper.properties
#Wed Sep 28 09:06:11 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip
distributionUrl=gradle-3.0-bin.zip参考:
https://www.zybuluo.com/xtccc/note/275168#wrapper-gradlew
http://dengyin2000.iteye.com/blog/2191658
http://blog.csdn.net/u011054333/article/details/53999590
如何运行使用gradle打包的项目的更多相关文章
- gradle 打包springboot项目,找不到项目jar application.class
如题:gradle 打包springboot项目,找不到项目jar入口main方法:application.class 检查:lib/目录下没有相应项目的jar包 用gradle命令行查看日志:gra ...
- weexpack打包weex项目运行/打包记录
构建weex项目 安装weex-toolkit cnpm install -g weex-toolkit 初始化一个项目只需新建文件夹并在目录下执行 weex init 即可 安装依赖:cnpm in ...
- IntelliJ IDEA打包WAR并部署运行(mac osx)将Web项目War包部署到Tomcat服务器基本步骤(完整版)
用IntelliJ IDEA做web开发体验很好,但导出war包比eclipse麻烦了不少,以下是解决方案: 打包:1.自动打包:File —> Project Structure —> ...
- webpack打包vue项目之后生成的dist文件该怎么启动运行
亲测,webpack打包vue项目之后生成的dist文件可以部署到 express 服务器上运行. 我的vue项目结构如下: 1. 进入该vue项目目录,打开git bash,执行:npm run b ...
- 用leiningen来运行和打包clojure项目
今天是2017年5月24日.隔壁team用clojure写了个工具,我们要拿来用,于是弄了个leiningen来尝试.还没有最后成功,先记录一下一些连蒙带猜的步骤,以免忘记. 一.单独运行的cloju ...
- 用gradle把springboot项目打包成jar
``` 用gradle把springboot项目打包成jar ```### build.gradle 中添加 buildscript { repositories { mavenLocal() mav ...
- docker 运行jenkins及vue项目与springboot项目(三.jenkins的使用及自动打包vue项目)
docker 运行jenkins及vue项目与springboot项目: 一.安装docker 二.docker运行jenkins为自动打包运行做准备 三.jenkins的使用及自动打包vue项目 四 ...
- 在eclipse中用gradle搭建MapReduce项目
我用的系统是ubuntu14.04新建一个Java Project. 这里用的是gradle打包,gradle默认找src/main/java下的类编译.src目录已经有了,手动在src下创建main ...
- Android Ant 和 Gradle 打包流程和效率对照
一.Ant 打包:(下载ant.配置环境变量就不说了) 1.进入命令行模式,并切换到项目文件夹.运行例如以下命令为ADT创建的项目加入ant build支持: android update proje ...
随机推荐
- $Noip2018/Luogu5019/Luogu1969$ 铺设道路
$Luogu$ 去年$Noip$的时候我并没有做过原题,然后考场上也没有想出正解,就写了个优化了一点的暴力:树状数组+差分,然后就$A$了$ovo$. $Sol$ 只要$O(N)$扫一遍,只要当前值比 ...
- 洛谷$1541$ 乌龟棋 线性$DP$
Luogu CH Sol f[i]表示走到第i个格子时获得的最大分数 发现转移与各个爬行卡片的数量有关,一共只有4种卡片 所以就把这四种卡片的已使用张数也放进状态,f[i][a][b][c][d] ...
- Python第二天了哇
在Python中input是接收用户输入的一个函数哇 a = int( b) 这个的意思是把b的值转换为整型? 好像是这个亚子 Python想要知道它的内置函数的话可以在Python的交互界面(She ...
- oop(面向对象语言的三大特征):封装,继承,多态; (抽象),函数绑定
封装/隐藏 : 通过类的访问限定符实现的 private public 继承的意义之一:代码的复用 类的继承是指在一个现有类的基础上去构建一个新的类,构造出来的新类被称为派生类(子类),现有 ...
- 人脸识别系统 —— 基于python的人工智能识别核心
起因 自打用python+django写了一个点菜系统,就一直沉迷python编程.正好前几天公司boss要我研究一下人脸识别,于是我先用python编写了一个人脸识别系统的核心,用于之后的整个系统. ...
- 一文搞定Spring Boot + Vue 项目在Linux Mysql环境的部署(强烈建议收藏)
本文介绍Spring Boot.Vue .Vue Element编写的项目,在Linux下的部署,系统采用Mysql数据库.按照本文进行项目部署,不迷路. 1. 前言 典型的软件开发,经过" ...
- 【PCIE-3】---PCIE设备的枚举扫描(经典好文)
前面两个小节大致总结了下PCIE的基本知识,算是扫盲篇吧.本文主要总结PCIE设备的枚举扫描过程,此部分才是PCIE模块的重点,无论是在BIOS下还是系统驱动下都会用到. 按照国际惯例,先列问题: 1 ...
- Akka Java 中文文档
Akka Java 中文文档 Introduction What is Akka? | 什么是Akka? Why Akka? | 为什么选择Akka? Getting Started | Akka入门 ...
- 【转】KAFKA分布式消息系统
Kafka[1]是linkedin用于日志处理的分布式消息队列,linkedin的日志数据容量大,但对可靠性要求不高,其日志数据主要包括用户行为(登录.浏览.点击.分享.喜欢)以及系统运行日志(CPU ...
- 自己动手搭环境—unit 1、Struts2环境搭建
1.web.xml中增加Struts2配置 <filter> <filter-name>struts2</filter-name> <filter-class ...