在gradle

时间:2017-11-21 18:10:58

标签: gradle

我是新手。我想将maven项目迁移到gradle。

以下是maven中的代码。

<repositories>
    <repository>
        <id>spring-libs-snapshot</id>
        <url>https://repo.spring.io/libs-snapshot</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-plugins-release</id>
        <url>https://repo.spring.io/plugins-release</url>
    </pluginRepository>
    <pluginRepository>
        <id>jcenter</id>
        <url>https://dl.bintray.com/asciidoctor/maven</url>
    </pluginRepository>
</pluginRepositories>

如何在gradle.build文件中配置上述maven配置?

1 个答案:

答案 0 :(得分:1)

以下是您需要的整个.gradle文件。您可以使用gradle init --type pom命令将现有的maven项目转换为gradle项目。请注意,这仍然是gradle的孵化功能。见https://docs.gradle.org/current/userguide/feature_lifecycle.html

apply plugin: 'java'
apply plugin: 'maven'

group = 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'

description = """spring-data-aerospike-example"""

sourceCompatibility = 1.5
targetCompatibility = 1.5
tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}



repositories {

     maven { url "https://repo.spring.io/libs-snapshot" }
     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile group: 'org.springframework.data', name: 'spring-data-commons', version:'1.11.0.RELEASE'
    compile group: 'org.springframework.data', name: 'spring-data-aerospike', version:'1.0.0.BUILD-SNAPSHOT'
    compile group: 'org.springframework.data', name: 'spring-data-keyvalue', version:'1.0.0.M1'
    compile group: 'org.springframework', name: 'spring-context', version:'4.1.7.RELEASE'
    compile group: 'org.springframework', name: 'spring-tx', version:'4.1.7.RELEASE'
    compile group: 'com.aerospike', name: 'aerospike-client', version:'3.1.3'
    compile group: 'log4j', name: 'log4j', version:'1.2.17'
    testCompile group: 'joda-time', name: 'joda-time', version:'2.7'
}