简体   繁体   English

Eclipse Luna Gradle插件添加了未引用的依赖项

[英]Eclipse Luna Gradle Plugin adds a dependency that is not referenced

I'm using Eclipse Luna and the Gradle Plugin for Eclipse Luna (Using the Gradle IDE Pack 3.6.x from Pivotal). 我正在使用Eclipse Luna和Eclipse Luna的Gradle插件(使用来自Pivotal的Gradle IDE Pack 3.6.x)。 I created a simple Java project with Gradle support. 我创建了一个具有Gradle支持的简单Java项目。 Below my build.gradle 在我的build.gradle下面

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'artifactory'

buildscript {
  repositories {
    maven { url 'http://dl.bintray.com/jfrog/jfrog-jars' }
    mavenCentral()
  }

  dependencies {
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.4')
  }
}

version = '1.0'

repositories {
  maven { url 'http://maven.restlet.com' }
  mavenCentral()
}

dependencies {
  compile group: 'com.cloudit4', name: 'cit4-util-lib', version: '1.0'
  compile group: 'org.restlet.gae', name: 'org.restlet', version: '2.3.2'
  compile group: 'org.restlet.gae', name: 'org.restlet.ext.servlet', version: '2.3.2'
}

// Artifactory...
artifactory {
  contextUrl = 'http://192.168.245.1:8081/artifactory'   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    contextUrl = 'http://192.168.245.1:8081/artifactory'   //The base Artifactory URL for the publisher
    //A closure defining publishing information
    repository {
        repoKey = 'libs-release-local'   //The Artifactory repository key to publish to
        username = 'admin'          //The publisher user name
        password = 'mypass'       //The publisher password
    }
  }
  resolve {
    contextUrl = 'http://192.168.245.1:8081/artifactory'   //The base Artifactory URL for the resolver
    repository {
        repoKey = 'repo'  //The Artifactory (preferably virtual) repository key to resolve from
    }
  }
}

As you may notice, I'm using Artifactory to host my own artifacts (local libraries, cit4-util-lib). 您可能会注意到,我正在使用Artifactory托管自己的工件(本地库,cit4-util-lib)。 Normally I work with projects that uses the Google App Engine library, and many times I included it in Gradle using the appengine plugin for gradle. 通常,我会处理使用Google App Engine库的项目,并且很多时候我使用appengine插件将其包含在Gradle中,以进行gradle。 But as you may see, this is not the case this time. 但是,您可能会看到,这次并非如此。 None of the dependencies has a dependency for Google App Engine libraries. 没有任何依赖关系与Google App Engine库具有依赖关系。 But when I do execute a Gradle dependencies refresh, a Google App Engine library is included in my dependencies. 但是当我执行Gradle依赖项刷新时,我的依赖项中包含Google App Engine库。 Somebody has seen this kind of behaviour? 有人看到过这种行为吗? Where does gradle looks for libraries to include in the project? gradle在哪里寻找要包含在项目中的库? is it only the dependencies that are explicitly set in the build.gradle file or are there more? 是仅在build.gradle文件中显式设置的依赖项还是更多? Thank you in advance for any help. 预先感谢您的任何帮助。

Regards 问候

Marco 马可

When you put a dependency in the dependency closure, gradle will included all of those depedencies' dependencies. 当您将依赖项放入依赖项关闭时,gradle将包括所有这些依赖关系的依赖项。 (look for "transitive dependencies" on https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html ) (在https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html上查找“传递依赖项”)

Taking a look at an old version of the pom for the org.restlet.gae dependency : https://maven-repository.com/artifact/org.restlet.gae/org.restlet/2.3.1/pom you can see the appengine dependency. 看看org.restlet.gae依赖项的pom的旧版本: https ://maven-repository.com/artifact/org.restlet.gae/org.restlet/2.3.1/pom,您可以看到appengine依赖性。 I would think that's where it's coming from. 我想这就是它的来历。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM