/*
* This build file was auto generated by running the Gradle 'init' task
* by 'Yang' at '16-9-18 下午5:48' with Gradle 3.0
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/3.0/userguide/tutorial_java_projects.html
*/
// Tomcat 須要
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.bmuschko:gradle-tomcat-plugin:2.2.3"
}
}
// 要使用的插件,看名字應該知道什麼做用
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: "com.bmuschko.tomcat"
// In this section you declarewhere to find the dependencies of your project
repositories {
// Use 'jcenter'for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
// jcenter()
// maven 的倉庫
mavenCentral()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.21'
// 依賴 servlet
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
// 配置 Tomcat 插件
def tomcatVersion = '8.0.27'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}
// Tomcat 配置
// Tomcat 配置tomcatRun.contextPath = 'testa/'
tomcatRunWar.contextPath = 'teats/'複製代碼
File > Settings > Build, Execution & Deployment > Compiler > Compiler and de-select Configure on demand The above still uses data but is faster, I was able to load images and maps. However, in addition, if >you want to be completely offline, you need to do the following: File -> Settings ->Build, Execution,Deployment -> Build Tools -> Gradle -> check Offline workgithub
試試有沒有配置成功web
gradlew build # 編譯項目
gradlew tasks # 查看任務複製代碼
建立 idea 項目文件
gradlew idea
複製代碼
若是以後項目更新了依賴,能夠運行下面的命令同步到 ideaapache
gradlew cleanIdea
複製代碼
用 Idea 打開項目 直接用 idea 打開 ipr 文件 按 alt + 1 能夠顯示文件導航側欄