前提:

1,已安装JDK

2, 有Intellij IDEA

3, 已安装Gradle

一分钟实现步骤:

1,mkdir Spring-MVC;cd Spring-MVC
2,gradle init
3,edit build.gradle file

/*
 * This build file was auto generated by running the Gradle 'init' task
 * by 'Administrator' at '16-10-2 下午8:42' with Gradle 3.1
 *
 * This generated file contains a commented-out 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.1/userguide/tutorial_java_projects.html
 */
 
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.akhikhl.gretty:gretty:+'
    }
}

ext {
    springVersion = '4.3.3.RELEASE'
} 

//apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
apply plugin: 'org.akhikhl.gretty'

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'


// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
    mavenCentral()
    maven { url 'http://repo.spring.io/release' } 
}

// In this section you declare the dependencies for your production and test code
dependencies {
    //core spring  
    compile ("org.springframework:spring-context:$springVersion")  
    compile ("org.springframework:spring-core:$springVersion")  
    compile ("org.springframework:spring-webmvc:$springVersion")  

    // The production code uses the SLF4J logging API at compile time
    compile ("org.slf4j:slf4j-api:1.7.21")

    // 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")
}
build gradle

相关文章:

  • 2021-09-19
  • 2022-02-23
  • 2021-09-26
  • 2021-06-25
  • 2022-01-18
猜你喜欢
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-06-02
  • 2021-05-05
相关资源
相似解决方案