1

I'm still new at maven, but I'm attempting to add a new repository to resolve a dependency in my project with no luck. I've added the following to my POM:

<repositories>
    <repository>
        <id>com.mvnrepository</id>
        <name>mvnrepository.com</name>
        <layout>default</layout>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_parent</artifactId>
        <version>2.10</version>
    </dependency>
</dependencies>

I tried switching layout from default to legacy in the off chance that my maven3 had some conflict with the maven2 repository, but that yielded nothing.

If anyone could tell me what I'm not doing correctly, I'd appreciate it.

UPDATE: I feel really stupid now, here's the output of my terminal. It looks like maven is attempting to resolve the dependency through our corporate repository. I suppose the questions should now be, how do I add this additional repository despite the fact I have a company repository defined in my settings.xml?

[ERROR] Failed to execute goal on project jmeter-analyzer: Could not resolve
dependencies for project <Project name here> Failure to find org.apache.jmeter:
ApacheJMeter_parent:jar:2.10 in http://<our internal corporate repo-url here> was
cached in the local repository, resolution will not be reattempted until the
update interval of <Company mirror name here> has elapsed or updates are forced
-> [Help 1]

UPDATE: It looks like it is definitely defined in my settings.xml file under: <mirrors>, <profiles>, and even <pluginGroups>. This shouldn't completely prevent me from adding a third party repo to this single project should it?

Jean-Rémy Revy
  • 5,607
  • 3
  • 39
  • 65
Niko
  • 4,158
  • 9
  • 46
  • 85
  • Is the dependency shown the missing one? – Chris Gerken Feb 27 '14 at 22:22
  • Yes, that is correct. – Niko Feb 27 '14 at 22:22
  • What is exactly the error message? Called MVN via command line ? Output ? – khmarbaise Feb 27 '14 at 22:26
  • I updated the question to include the error I'm getting from my terminal via `mvn`. I feel really stupid now, it's being pointed to the wrong repo because I'm working on a company computer. How can I add this third party repo while working with the company repo at the same time? – Niko Feb 27 '14 at 22:34
  • I don't understand it either, because `ApacheJMeter_parent` shows up in a search of the Central Maven Repository. I'm able to build a Maven project with the `ApacheJMeter` artifact, but not `ApacheJMeter_parent`. – ktm5124 Feb 27 '14 at 23:07

2 Answers2

0

Your company maven repository manager(Artifactory, Nexus etc.) should include repo1.maven.org as a remote repository. As far as I know, you need also the rights to deploy to this repository.

Patrick
  • 447
  • 8
  • 17
0

I figured it out.

Firstly : find the right repository

First off, I didn't need to define the repository. I found this answer on another SO thread stating that the url I was attempting to add wasn't actually a repo. With further research I found the artifact I'm trying to add is actually from the default repo so it should find it.

Secondly : provide the right dependencies

I did a little more digging and found a similar project, from it's POM file I realized that the reason I wasn't able to download the file was because I hadn't explicitly provided its other dependencies. I'll include them here (not because I think the dependencies I have are necessarily going to be relevant, but I hate when people link to code that might disappear in the future)

<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_core</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_components</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_functions</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_http</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_java</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_report</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_tcp</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_ftp</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_jdbc</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_jms</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_ldap</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_mail</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_mongodb</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_junit</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_monitors</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_native</artifactId>
    <version>2.10</version>
</dependency>
<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_config</artifactId>
    <version>2.10</version>
</dependency>
Community
  • 1
  • 1
Niko
  • 4,158
  • 9
  • 46
  • 85
  • 1
    Indeed, a "parent" project is often only a pom packaging. It doesn't contain any code, and so doesn't provide any services. You must declare what "jar" you need, as if you declare Spring Dependencies. You cannot just tell Maven "I want ALL Spring libs and dependencies", it's a non sense :) – Jean-Rémy Revy Feb 27 '14 at 23:18
  • 1
    Another thought : declare a property if you want to use many libs in the same version, and use it in each dependency tag related to this framework. – Jean-Rémy Revy Feb 27 '14 at 23:19
  • Ahhh, that makes everything all the clearer. Thanks for the tips/edit :) – Niko Feb 27 '14 at 23:23