2017-11-21 4 views
0

私はgradleを初めて利用しています。 mavenプロジェクトをgradleに移行したい。gradでMaven相当のリポジトリを設定する

以下は、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> 

上記のmaven設定をgradle.buildファイルに設定するにはどうすればよいですか?

+1

ドキュメントを読んだことがありますか? https://docs.gradle.org/current/userguide/dependency_management.html#sec:repositories –

+0

Maven POMファイル全体を投稿できます –

+0

これはmavenファイルです - https://github.com/carosys/spring-data -aerospike-example/blob/master/spring-data-aerospike-example/pom.xml –

答えて

1

ここには、.gradleファイルが必要です。 gradle init --type pomコマンドを使用して既存のMavenプロジェクトをプロジェクトに変換することができます。これはまだグラデーションのインキュベーション機能です。 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' 
} 
関連する問題