相关疑难解决方法(0)

Gradle - 获取依赖项的最新版本

告诉Gradle以下内容最简单的方法是什么:

检索'junit'依赖关系并采用其最新的'release'版本.

管理Maven和Ivy存储库对我来说有点新鲜.我尝试了以下步骤,导致Could not resolve dependency ...错误:

  • compile "junit:junit:latest.release"用存储库设置为只写mavenCentral() (但是,如果我说"junit:junit:4.10",它就可以工作).

  • compile "junit:junit:latest.release"使用存储库写入以下方式:

    ivy {
        // I also tried 'http://maven.org' and other possible variants.           
        url "http://repo1.maven.org" 
        layout "maven"
    }
    
    Run Code Online (Sandbox Code Playgroud)
  • 尝试使用Spring Source Ivy存储库:

    ivy {
        artifactPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
        ivyPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
    }
    
    Run Code Online (Sandbox Code Playgroud)

也许我误解了一些事情.为什么获得最新版本的依赖是如此艰巨的任务?

java dependencies ivy gradle maven

86
推荐指数
4
解决办法
8万
查看次数

在项目中使用gradle插件,其依赖项也使用相同的插件

我是新手(从maven离开).现在我有一个问题.我有一个gradle构建,我想使用com.bmuschko.nexus插件.但我的项目涉及另一个项目,我也想使用com.bmuschko.nexus插件.

因此,当我构建时,我得到一个例外:

Plugin 'com.bmuschko.nexus' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add  "apply plugin: 'com.bmuschko.nexus'" to the body of the script to use the plugin.
Run Code Online (Sandbox Code Playgroud)

但是当我这样做时 - >将"apply plugin:'com.bmuschko.nexus'"添加到脚本体中以使用该插件.我会得到另一个例外:

> Failed to apply plugin [id 'com.bmuschko.nexus']
   > Plugin with id 'com.bmuschko.nexus' not found.
Run Code Online (Sandbox Code Playgroud)

嗯......我可以解决这个问题吗?

settings.gradle

include ':config'
project(':config').projectDir = new File(settingsDir, '../zConfig')
Run Code Online (Sandbox Code Playgroud)

的build.gradle

plugins {
        // id "com.bmuschko.nexus" version "2.3" // already in classpath
        id "me.champeau.gradle.antlr4" version "0.1" …
Run Code Online (Sandbox Code Playgroud)

java gradle

5
推荐指数
1
解决办法
2894
查看次数

标签 统计

gradle ×2

java ×2

dependencies ×1

ivy ×1

maven ×1