Reputation: 4448
For some reason, I cannot get maven to list or download a dependency for a fresh project. I have used this particular dependency before so I'm not sure why it isn't working now. From my pom file:
<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>
Yet, when I try mvn dependency:resolve
it doesn't find anything. (I've checked ~/.m2/repository/ directory and its still empty.)
[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] ------------------------------------------------------------------------
I can't get a mvn dependency:tree
to print anything either.
[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] ------------------------------------------------------------------------
Is there something that I'm doing wrong? I can't spot anything obvious so I'm not sure why it isn't resolving.
Upvotes: 0
Views: 724
Reputation: 3155
The <dependencyManagement>
tag is not used for defining what dependencies you need. Its used to specify how to configure a dependency (which version, scope, etc) if it is found on the dependencies for a project.
To define the actual dependencies you need to use the <dependencies>
tag:
<dependencies>
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
</dependency>
</dependencies>
See differences between dependencymanagement and dependencies in maven for more information.
Upvotes: 4