出于某种原因,我无法让maven列出或下载新项目的依赖项。我之前使用过这种特殊的依赖关系,因此我不确定为什么它现在不起作用。从我的pom文件:
<properties>
<splunksdk.version>1.3.0</splunksdk.version>
</properties>
<repositories>
<repository>
<id>ext-release-local</id>
<url>http://splunk.artifactoryonline.com/splunk/ext-releases-local</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>${splunksdk.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
然而,当我尝试mvn dependency:resolve
时,它找不到任何东西。 (我已经检查了〜/ .m2 / repository /目录,但它仍然是空的。)
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Splunk Scrapper 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:resolve (default-cli) @ SplunkScrapper ---
[INFO]
[INFO] The following files have been resolved:
[INFO] none
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.906s
[INFO] Finished at: Wed Sep 17 16:27:25 MDT 2014
[INFO] Final Memory: 8M/239M
[INFO] ------------------------------------------------------------------------
我无法获得mvn dependency:tree
打印任何内容。
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Splunk Scrapper 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ SplunkScrapper ---
[INFO] com.company.project:SplunkScrapper:jar:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.096s
[INFO] Finished at: Wed Sep 17 16:28:46 MDT 2014
[INFO] Final Memory: 8M/236M
[INFO] ------------------------------------------------------------------------
有什么我做错了吗?我无法发现任何明显的东西,所以我不确定它为什么不能解决。
答案 0 :(得分:4)
<dependencyManagement>
标记不用于定义所需的依赖项。它用于指定如何在项目的依赖项中找到依赖项(版本,范围等)。
要定义使用<dependencies>
标记所需的实际依赖关系:
<dependencies>
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
</dependency>
</dependencies>
有关详细信息,请参阅differences between dependencymanagement and dependencies in maven。