如何将maven pom标签<snapshot>转换为gradle

时间:2017-12-03 09:59:18

标签: maven gradle build.gradle pom.xml

我想使用来自github的sql解析库:
该页面显示,Maven需要以下pom.xml代码才能导入。

<repositories>
    <repository>
        <id>jsqlparser-snapshots</id>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.jsqlparser</groupId>
    <artifactId>jsqlparser</artifactId>
    <version>1.1</version>
</dependency>

但是,我正在使用gradle。因此,上述dependency中的pom.xml部分会或多或少地转变为gradle.build

dependencies {
    compile("com.github.jsqlparser:jsqlparser:1.1")
}

但我不知道如何转换repository代码的内容,特别是snapshoturl

1 个答案:

答案 0 :(得分:1)

Do you really want to use snapshot builds, which is latest development version that might break stuff inadvertently? If not, you read the instructions wrongly. You can simply use mavenCentral() or jcenter() as Gradle repository for your build to get the latest released version of that library.

If you really want the snapshot versions, you use maven { url 'https://oss.sonatype.org/content/groups/public' } and use x.y-SNAPSHOT in the version, or something like x.+ for the latest available version, including snapshot versions. You don't need to specially enable snapshot version usage with Gradle.